- substr: documentation ( source)
- uniqid: documentation ( source)
- base_convert: documentation ( source)
- rand: documentation ( source)
- md5: documentation ( source)
<?php
$length = 8;
$id = substr(base_convert(md5(uniqid(rand(), true)), 16, 36), 1, $length);
print $id;