3v4l.org

run code in 300+ PHP versions simultaneously
<?php $uuid = sprintf('%04x%04x%04x%04x%04x%04x%04x%04x', // 32 bits for "time_low" mt_rand(0, 0xffff), mt_rand(0, 0xffff), // 16 bits for "time_mid" mt_rand(0, 0xffff), // 16 bits for "time_hi_and_version", // four most significant bits holds version number 4 mt_rand(0, 0x0fff) | 0x4000, // 16 bits, 8 bits for "clk_seq_hi_res", // 8 bits for "clk_seq_low", // two most significant bits holds zero and one // for variant DCE1.1 mt_rand(0, 0x3fff) | 0x8000, // 48 bits for "node" mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) ); $packedUuid = pack('H*', $uuid); echo $uuid . PHP_EOL; echo strlen($uuid) . PHP_EOL; echo $packedUuid . PHP_EOL; echo strlen($packedUuid) . 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)
7.3.10.0070.01016.67
7.3.00.0070.00316.39
7.2.130.0000.01616.47
7.2.120.0100.00716.66
7.2.110.0000.01816.90
7.2.100.0030.01416.75
7.2.90.0030.01016.97
7.2.80.0030.01216.84
7.2.70.0100.00716.93
7.2.60.0090.00616.95
7.2.50.0030.01016.80
7.2.40.0070.01017.14
7.2.30.0060.00916.97
7.2.20.0000.01316.96
7.2.10.0070.00716.98
7.2.00.0030.01118.06
7.1.250.0100.00315.39
7.1.70.0070.00417.09
7.1.60.0500.00614.63
7.1.50.0140.01116.94
7.1.00.0030.03322.40
7.0.200.0030.00716.64
7.0.140.0000.07321.99
7.0.60.0100.08019.83
7.0.50.0030.06717.82
7.0.40.0030.07020.04
7.0.30.0270.04020.18
7.0.20.0370.07320.16
7.0.10.0200.07020.20
7.0.00.0070.08020.12
5.6.280.0070.07021.07
5.6.210.0030.04020.51
5.6.200.0100.04318.18
5.6.190.0130.05020.61
5.6.180.0270.05320.41
5.6.170.0230.08320.44
5.6.160.0000.05320.44
5.6.150.0070.04718.09
5.6.140.0030.07318.18
5.6.130.0130.08018.21
5.6.120.0000.09720.98
5.6.110.0070.09021.04
5.6.100.0230.07021.13
5.6.90.0130.07021.10
5.6.80.0070.06320.40
5.6.70.3900.03720.36
5.5.350.0030.08320.43
5.5.340.0100.03318.00
5.5.330.0100.08020.07
5.5.320.0500.07020.31
5.5.310.0230.03320.41
5.5.300.0070.07718.02
5.5.290.0100.08017.91
5.5.280.0070.05020.77
5.5.270.0000.04720.86
5.5.260.0000.08720.88
5.5.250.0030.04720.59
5.5.240.0200.07720.18
5.4.450.0270.06019.11
5.4.440.0870.05319.13
5.4.430.0870.06019.27
5.4.420.0830.05019.62
5.4.410.0170.07018.91
5.4.400.1230.05318.51
5.4.390.1830.05718.69
5.4.380.0330.04018.75
5.4.370.0170.05018.58
5.4.360.0170.05018.78
5.4.350.0080.03811.97
5.4.340.0110.03711.97
5.4.320.0090.03512.45
5.4.310.0040.04912.45
5.4.300.0040.03912.46
5.4.290.0060.04112.45
5.4.280.0060.03512.35
5.4.270.0040.03812.35
5.4.260.0030.04212.35
5.4.250.0070.03512.35
5.4.240.0330.06318.88
5.4.230.0170.05318.90
5.4.220.0170.05318.72
5.4.210.0130.05318.75
5.4.200.0200.04718.52
5.4.190.0230.06718.93
5.4.180.0230.07018.86
5.4.170.0370.05318.77
5.4.160.0170.05318.94
5.4.150.0200.05718.73
5.4.140.0170.05316.00
5.4.130.0030.06316.18
5.4.120.0100.04716.21
5.4.110.0100.05316.26
5.4.100.0130.06016.02
5.4.90.0270.04316.38
5.4.80.0070.05016.41
5.4.70.0130.05716.10
5.4.60.0070.06716.50
5.4.50.0000.05316.20
5.4.40.0030.05016.41
5.4.30.0030.05016.25
5.4.20.0130.04716.37
5.4.10.0100.06316.40
5.4.00.0030.05015.79
5.3.290.0070.03812.80
5.3.280.0130.06714.41
5.3.270.0300.06014.44
5.3.260.0170.04314.45
5.3.250.0100.05314.46
5.3.240.0000.06014.38
5.3.230.0070.06014.64
5.3.220.0170.04314.64
5.3.210.0130.05014.41
5.3.200.0170.04314.57
5.3.190.0030.08314.58
5.3.180.0070.07314.56
5.3.170.0130.07314.45
5.3.160.0070.07014.56
5.3.150.0030.05714.58
5.3.140.0000.05714.39
5.3.130.0030.05714.56
5.3.120.0100.04714.55
5.3.110.0000.05714.25
5.3.100.0030.05013.98
5.3.90.0070.05014.02
5.3.80.0070.04714.16
5.3.70.0130.06014.01
5.3.60.0170.06014.01
5.3.50.0130.04314.01
5.3.40.0130.05713.89
5.3.30.0030.05013.68
5.3.20.0030.05713.70
5.3.10.0030.05013.42
5.3.00.0070.05313.66
5.2.170.0070.04011.06
5.2.160.0000.04311.16
5.2.150.0070.04011.14
5.2.140.0070.04011.25
5.2.130.0100.03711.21
5.2.120.0130.03010.95
5.2.110.0070.03711.21
5.2.100.0030.04710.86
5.2.90.0030.05010.86
5.2.80.0100.05010.97
5.2.70.0070.03711.01
5.2.60.0030.04011.01
5.2.50.0030.06011.11
5.2.40.0100.03310.91
5.2.30.0030.04311.08
5.2.20.0070.03311.05
5.2.10.0030.04011.02
5.2.00.0030.05010.71
5.1.60.0070.03310.23
5.1.50.0000.03710.08
5.1.40.0070.03010.23
5.1.30.0100.03010.41
5.1.20.0100.03310.43
5.1.10.0030.03310.23
5.1.00.0030.03310.16
5.0.50.0030.0308.64
5.0.40.0100.0308.47
5.0.30.0070.0508.20
5.0.20.0030.0278.11
5.0.10.0030.0278.38
5.0.00.0070.0478.26
4.4.90.0070.0176.87
4.4.80.0070.0206.87
4.4.70.0000.0276.87
4.4.60.0030.0176.87
4.4.50.0030.0206.87
4.4.40.0030.0336.87
4.4.30.0130.0106.87
4.4.20.0070.0176.87
4.4.10.0000.0336.87
4.4.00.0030.0306.77
4.3.110.0030.0236.77
4.3.100.0030.0206.77
4.3.90.0030.0206.77
4.3.80.0030.0376.77
4.3.70.0070.0176.77
4.3.60.0000.0306.77
4.3.50.0000.0336.77
4.3.40.0000.0406.77
4.3.30.0030.0206.77
4.3.20.0030.0206.77
4.3.10.0000.0206.77
4.3.00.0070.0236.88

preferences:
36.32 ms | 401 KiB | 5 Q