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 ?

    function pass() {
        $chars = array(

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

        return $pass;

    echo pass();