3v4l.org

run code in 300+ PHP versions simultaneously
<?php function uuid7(): string { $msec = (int)(microtime(true) * 1000); // 48-bit timestamp (big-endian) $timeBytes = pack("J", $msec); $timeBytes = substr($timeBytes, -6); $rand = random_bytes(10); $bytes = $timeBytes . $rand; // Version 7 $bytes[6] = chr((ord($bytes[6]) & 0x0f) | 0x70); // Variant RFC 4122 (10xx) $bytes[8] = chr((ord($bytes[8]) & 0x3f) | 0x80); $hex = bin2hex($bytes); return sprintf( '%s-%s-%s-%s-%s', substr($hex, 0, 8), substr($hex, 8, 4), substr($hex, 12, 4), substr($hex, 16, 4), substr($hex, 20) ); } for ($i = 0; $i < 100; $i++) { echo uuid7() . PHP_EOL; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.130.0060.00418.89
8.4.120.0200.00917.30
8.4.110.0190.00417.59
8.4.100.0180.00617.77
8.4.90.0180.00617.50
8.4.80.0200.00317.41
8.4.70.0160.00617.58
8.4.60.0130.00817.39
8.4.50.0160.00617.56
8.4.40.0190.00417.72
8.4.30.0230.00117.54
8.4.20.0210.00417.66
8.4.10.0230.00217.73
8.3.260.0190.00216.16
8.3.250.0180.00516.36
8.3.240.0180.00616.27
8.3.230.0170.00516.21
8.3.220.0160.00516.21
8.3.210.0210.00216.34
8.3.200.0160.00316.38
8.3.190.0170.00616.15
8.3.180.0170.00416.31
8.3.170.0190.00216.12
8.3.160.0200.00416.43
8.3.150.0180.00616.16
8.3.140.0220.00216.39
8.3.130.0150.00416.43
8.3.120.0170.00616.15
8.3.110.0140.00516.59
8.3.100.0180.00416.34
8.3.90.0210.00216.53
8.3.80.0210.00516.44
8.3.70.0180.00516.61
8.3.60.0180.00416.31
8.3.50.0180.00516.26
8.3.40.0190.00217.31
8.3.30.0150.00217.43
8.3.20.0120.00617.36
8.3.10.0120.00617.31
8.3.00.0120.00617.45
8.2.290.0130.00416.43
8.2.280.0160.00216.48
8.2.270.0110.00716.78
8.2.260.0110.00716.41
8.2.250.0160.00416.34
8.2.240.0140.00516.64
8.2.230.0150.00316.29
8.2.220.0140.00716.52
8.2.210.0170.00216.66
8.2.200.0140.00416.32
8.2.190.0180.00316.60
8.2.180.0100.00816.29
8.2.170.0170.00517.73
8.2.160.0170.00317.55
8.2.150.0120.00817.39
8.2.140.0160.00417.58
8.2.130.0200.00317.37
8.2.120.0160.00417.50
8.2.110.0170.00317.50
8.2.100.0130.00817.14
8.2.90.0170.00217.48
8.2.80.0200.00317.41
8.2.70.0160.00617.30
8.2.60.0130.00717.36
8.2.50.0200.00517.42
8.2.40.0150.00317.48
8.2.30.0160.00317.23
8.2.20.0160.00417.40
8.2.10.0110.00817.51
8.2.00.0180.00317.31

preferences:
30.67 ms | 403 KiB | 5 Q