0

hi

i want to create some random password for users who sign up in the website

also i want to use from rand command in php for creating some numbers among some characters and the results will be some things like this : sa231dsaw22sa

suppose it as a example of random password. please help me with this ?

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by pritaeas
1
<?php
    function pass() {
        $chars = array(
           'B','C','D','F','G','H','J','K','L','M',
           'N','P','Q','R','S','T','V','W','X','Y',
           'Z','b','c','d','f','g','h','j','k','m',
           'n','p','q','r','s','t','v','w','x','y',
           'z','2','3','4','5','6','7','8','9'
        );

        $pass = '';
        for ($i = 0; $i < 8; $i++) {
            $pass .= $chars[rand(0, 48)];
        }

        return $pass;
    }

    echo pass();
?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.