Q:

Write a PHP script to generate simple random password from a given string

belongs to collection: String PHP programs with examples

0

Write a PHP script to generate simple random password from a given string

Note : Password length should be be 6, 7, 8,9,10.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

PHP is a server scripting language, and It is a powerful tool for making interactive and dynamic Web-pages. I have used WampServer 2.2 for following example.

<?php
function password_generate($char) 
{
  $data = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcefghijklmnopqrstuvwxyz';
  return substr(str_shuffle($data), 0, $char);
}
  echo password_generate(10)."\n";
?>

Result:

ezStEbXAl2

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a PHP script to print the next character of ... >>
<< Write a PHP script to replace the first ‘the’ ...