<?php
class Utils {
public static function guid()
{
return sprintf("%04X%04X-%04X-%04X-%04X-%04X%04X%04X",
rand(0, 65535), rand(0, 65535),
rand(0, 65535), rand(16384, 20479),
rand(32768, 49151), rand(0, 65535),
rand(0, 65535), rand(0, 65535));
}
}
$count = 1000000;
$i = 0;
$time = microtime(true);
while ($i++ < $count) {
Utils::guid();
}
echo "total: " . (microtime(true) - $time) . "\n";
echo Utils::guid();
preferences:
34.86 ms | 402 KiB | 5 Q