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); $unpackedUuid = unpack('H*', $packedUuid); $unpackedUuid = $unpackedUuid[1]; echo $uuid . PHP_EOL; echo strlen($uuid) . PHP_EOL; echo $packedUuid . PHP_EOL; echo strlen($packedUuid) . PHP_EOL; echo $unpackedUuid . PHP_EOL; echo strlen($unpackedUuid) . 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.2.00.0040.00819.50
7.1.70.0050.00516.86
7.1.60.0100.01319.40
7.1.50.0060.00616.91
7.1.00.0100.06722.44
7.0.200.0030.00716.60
7.0.140.0000.07722.00
7.0.60.0130.07719.96
7.0.50.0130.05017.81
7.0.40.0030.04317.73
7.0.30.0070.08017.75
7.0.20.0130.04317.69
7.0.10.0230.06317.75
7.0.00.0200.04317.66
5.6.280.0000.07720.92
5.6.210.0170.06320.66
5.6.200.0030.04318.11
5.6.190.0030.06018.20
5.6.180.0130.04718.12
5.6.170.0200.06718.21
5.6.160.0030.08318.12
5.6.150.0070.08318.14
5.6.140.0100.06718.20
5.6.130.0000.05018.07
5.6.120.0030.07018.21
5.6.110.0000.08318.11
5.6.100.0030.08018.16
5.6.90.0000.06718.09
5.6.80.0100.05717.61
5.6.70.0100.08017.59
5.6.60.0070.06017.52
5.6.50.0100.05317.46
5.6.40.0170.07317.54
5.6.30.0070.08017.54
5.6.20.0100.03317.47
5.6.10.0130.07017.56
5.6.00.0170.07317.49
5.5.350.0230.05720.41
5.5.340.0100.05017.97
5.5.330.0030.05317.97
5.5.320.0100.07317.92
5.5.310.0130.07317.91
5.5.300.0130.07318.04
5.5.290.0000.04717.95
5.5.280.0100.04718.01
5.5.270.0000.06317.94
5.5.260.0130.08018.00
5.5.250.0130.08017.73
5.5.240.0070.07317.36
5.5.230.0070.07317.30
5.5.220.0030.07717.36
5.5.210.0200.06717.29
5.5.200.0000.07717.33
5.5.190.0000.08317.35
5.5.180.0030.08017.27
5.5.160.0100.07317.37
5.5.150.0070.08017.22
5.5.140.0070.08017.27
5.5.130.0130.06317.25
5.5.120.0070.08017.34
5.5.110.0200.03717.35
5.5.100.0070.08017.12
5.5.90.0070.07717.27
5.5.80.0000.06317.23
5.5.70.0070.04017.23
5.5.60.0130.06717.25
5.5.50.0170.07017.25
5.5.40.0070.05317.23
5.5.30.0170.06717.14
5.5.20.0100.05317.18
5.5.10.0130.07017.13
5.5.00.0030.06717.15
5.4.450.0030.04319.37
5.4.440.0000.08019.31
5.4.430.0070.07019.30
5.4.420.0070.07719.45
5.4.410.0030.08019.10
5.4.400.0130.06719.03
5.4.390.0100.06018.98
5.4.380.0100.05018.98
5.4.370.0170.07019.13
5.4.360.0130.06018.99
5.4.350.0130.07319.02
5.4.340.0070.07718.89
5.4.320.0130.07018.98
5.4.310.0130.07019.09
5.4.300.0100.07318.98
5.4.290.0030.08018.91
5.4.280.0130.07319.21
5.4.270.0100.07019.02
5.4.260.0070.06718.95
5.4.250.0100.06718.97
5.4.240.0100.05719.11
5.4.230.0100.07018.97
5.4.220.0070.04019.04
5.4.210.0030.05318.96
5.4.200.0100.07319.11
5.4.190.0030.07718.87
5.4.180.0100.05719.11
5.4.170.0100.07319.03
5.4.160.0000.08018.81
5.4.150.0130.05718.99
5.4.140.0070.07316.27
5.4.130.0200.05716.28
5.4.120.0000.06716.44
5.4.110.0100.05716.25
5.4.100.0030.04016.36
5.4.90.0030.05016.29
5.4.80.0100.05716.32
5.4.70.0030.04716.50
5.4.60.0030.03316.20
5.4.50.0030.03316.14
5.4.40.0030.03716.36
5.4.30.0030.03316.25
5.4.20.0030.03316.30
5.4.10.0030.03716.23
5.4.00.0070.03015.73
5.3.290.0070.07314.65
5.3.280.0100.07714.57
5.3.270.0000.04314.70
5.3.260.0070.07714.55
5.3.250.0070.07714.54
5.3.240.0100.06014.59
5.3.230.0030.07714.54
5.3.220.0070.07314.49
5.3.210.0170.07014.39
5.3.200.0130.07014.51
5.3.190.0000.05314.52
5.3.180.0130.06314.53
5.3.170.0100.06714.40
5.3.160.0100.03314.54
5.3.150.0000.03714.54
5.3.140.0070.03314.53
5.3.130.0070.03714.34
5.3.120.0000.04014.64
5.3.110.0070.03314.50
5.3.100.0030.03713.98
5.3.90.0000.03713.85
5.3.80.0000.05013.79
5.3.70.0070.03313.95
5.3.60.0070.03313.79
5.3.50.0070.03313.92
5.3.40.0000.04013.81
5.3.30.0100.03013.89
5.3.20.0030.03313.64
5.3.10.0070.03013.43
5.3.00.0030.03313.57
5.2.170.0030.03011.09
5.2.160.0000.03311.09
5.2.150.0000.03011.01
5.2.140.0070.02710.97
5.2.130.0030.02711.08
5.2.120.0000.03011.07
5.2.110.0030.02711.25
5.2.100.0000.03011.26
5.2.90.0070.02711.08
5.2.80.0000.03711.08
5.2.70.0000.03011.13
5.2.60.0000.03010.86
5.2.50.0000.03011.02
5.2.40.0070.03310.89
5.2.30.0000.03010.95
5.2.20.0030.02710.80
5.2.10.0000.03710.89
5.2.00.0100.02010.94
5.1.60.0030.0239.92
5.1.50.0030.02310.03
5.1.40.0130.04010.02
5.1.30.0070.05310.35
5.1.20.0030.05710.34
5.1.10.0030.05310.28
5.1.00.0030.04010.04
5.0.50.0030.0208.58
5.0.40.0000.0238.45
5.0.30.0030.0578.43
5.0.20.0000.0278.30
5.0.10.0070.0438.16
5.0.00.0070.0638.15
4.4.90.0000.0177.54
4.4.80.0000.0177.54
4.4.70.0030.0137.54
4.4.60.0000.0177.54
4.4.50.0000.0137.54
4.4.40.0030.0237.54
4.4.30.0000.0277.54
4.4.20.0030.0277.54
4.4.10.0030.0207.54
4.4.00.0000.0277.54
4.3.110.0030.0307.54
4.3.100.0030.0337.54
4.3.90.0030.0207.54
4.3.80.0030.0337.54
4.3.70.0070.0107.54
4.3.60.0070.0307.54
4.3.50.0000.0377.54
4.3.40.0000.0377.54
4.3.30.0030.0237.54
4.3.20.0000.0207.54
4.3.10.0030.0177.54
4.3.00.0000.0377.54

preferences:
42.21 ms | 401 KiB | 5 Q