<?php
//determine the length
$length = '10';
//generate a random id. Encrypt it and set it as $random
$random = crypt(uniqid(rand(),1));
//if you want to remove any slashes
$random_no_slashes = strip_tags(stripslashes($random));
//remove any . and or reversing the string
$random_id = str_replace(".","",$random_no_slashes);
$random_final = strrev(str_replace("/","",$random_id));
//take the first 10 characters from $random_final
$random_use = substr($random_final,0,$length);
echo "Random Id: $random_use" ;
echo "<br>";
?>