create a password with numbers in php

To create a password with numbers in php, you can use the rand function to generate a random integer between 0 and 9 and append it to your password string. You can repeat this step for the desired length of your password. Here's an example:

main.php
<?php
$password = '';
$length = 8;
for ($i = 0; $i < $length; $i++) {
    $password .= rand(0, 9);
}
echo $password;
?>
120 chars
9 lines

In this example, a password of length 8 is generated using rand to append a random integer between 0 and 9 to the password string for 8 iterations of the loop. The resulting password will be a random sequence of 8 numbers.

gistlibby LogSnag