Skip to content

Instantly share code, notes, and snippets.

View MohamedBoualleg's full-sized avatar

Mohamed Bouallegue MohamedBoualleg

View GitHub Profile
@MohamedBoualleg
MohamedBoualleg / randomStr
Created June 12, 2015 23:44
php function that generate a random string
function randomStr($lenght){
$str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789';
$str = str_shuffle($str);
while (strlen($str) < $lenght) {
$str = $str.randomStr($lenght - strlen($str));
}
return substr($str, strlen($str) - $lenght);
}