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-%04x-%04x-%04x-%04x%04x%04x', time(), $x4(), $x4(), $x4(), $x4(), $x4(), $x4(), $x4() ); } echo uuid();

preferences:
31.11 ms | 402 KiB | 5 Q