- substr: documentation ( source)
- uniqid: documentation ( source)
- mt_rand: documentation ( source)
- str_replace: documentation ( source)
- dechex: documentation ( source)
<?php
$uniqid_with_more_entropy = uniqid('', true);
$uniqid_13x = substr($uniqid_with_more_entropy, 0, 13);
$more_entropy = substr($uniqid_with_more_entropy, 13);
$more_entropy = str_replace('.', '', $more_entropy);
dechex(mt_rand(0, 0xFFF)) . dechex(mt_rand(0, 0xFFFFFFFF)) . $uniqid_13x . dechex((int)((string)mt_rand(0, 4) . $more_entropy));