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

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

Introduction

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

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

Leave a Comment