- substr: documentation ( source)
- posix_getpid: documentation ( source)
- microtime: documentation ( source)
- mt_rand: documentation ( source)
- sha1: documentation ( source)
- strtoupper: documentation ( source)
- rand: documentation ( source)
<?php
$token = sha1( mt_rand() . posix_getpid() . microtime( true ) );
echo substr( $token, rand( 0, 3 ), rand( 4, 6 ) )
. strtoupper( substr( $token, rand( 2, 5 ), rand( 2, 7 ) ) )
. substr( $token, rand( 20, 30 ), rand( 5, 8 ) );