programming-examples/php/String/PHP script to generate simple random password [do not use rand() function] from a given string.php

8 lines
212 B
PHP
Raw Permalink Normal View History

2019-11-15 12:59:38 +01:00
<?php
function password_generate($chars)
{
$data = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcefghijklmnopqrstuvwxyz';
return substr(str_shuffle($data), 0, $chars);
}
echo password_generate(7)."\n";
?>