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 ?

<?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();
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.