openssl_random_pseudo_bytes

openssl_random_pseudo_bytes is used for cryptographical randomness where rnd() isn't suitable $salt = openssl_random_pseudo_bytes(22); $salt = substr(strtr(base64_encode($salt), array('_' => '.', '~' => '/')),0,22); //Sets length to 22 characters    

Read More

Generate random string

//******************************************** //******************************************** //********** GENERATE RANDOM STRING ********** //******************************************** //******************************************** function GenerateRandomString($string_length) { $characters = '0123456789abcdefghijklmnopqrstuvwxyz'; $string = ''; for ($count = 0; $count < $string_length; $count++) { $string .= $characters[mt_rand(0, (strlen($characters) – 1))]; } return $string; }

Read More