3v4l.org

run code in 300+ PHP versions simultaneously
<?php function uuid() { $x4 = function() { $n = ''; while (strlen($n) < 4) { $n = $n.mt_rand(); } return substr($n, -4); }; return sprintf( '%s-%04d-%04d-%04d-%04d%04d%04d', time(), $x4(), $x4(), $x4(), $x4(), $x4(), $x4(), $x4() ); } echo uuid();

preferences:
31.01 ms | 402 KiB | 5 Q