Code Snippets Php

// function to generate random strings
function RandomString($length=32)
{
$randstr='';
srand((double)microtime()*1000000);
//our array add all letters and numbers if you wish
$chars = array ( 'a','b','c','d','e','f');
for ($rand = 0; $rand <= $length; $rand++)
{
$random = rand(0, count($chars) -1);
$randstr .= $chars[$random];
}
return $randstr;
}
?>
and call it like this
echo RandomString(8);
?>