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); 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.3.10.0130.00316.45
7.3.00.0090.00616.29
7.2.130.0090.01016.53
7.2.120.0110.00916.72
7.2.110.0110.00616.57
7.2.100.0170.00616.32
7.2.90.0130.00016.71
7.2.80.0080.00817.01
7.2.70.0130.00316.52
7.2.60.0120.00317.05
7.2.50.0030.01016.41
7.2.40.0040.01116.60
7.2.30.0040.00816.52
7.2.20.0000.01416.70
7.2.10.0100.00016.89
7.2.00.0090.00517.91
7.1.250.0060.00815.29
7.1.70.0040.00417.15
7.1.60.0160.00615.37
7.1.50.0100.01016.86
7.1.00.0000.03722.32
7.0.200.0030.00916.66
7.0.140.0030.07322.02
7.0.60.0230.07719.98
7.0.50.0070.07717.89
7.0.40.0130.06719.90
7.0.30.0300.07320.33
7.0.20.0270.07720.17
7.0.10.0070.06020.16
7.0.00.0100.05720.08
5.6.280.0070.07020.81
5.6.210.0170.05720.52
5.6.200.0030.08318.22
5.6.190.0100.05320.41
5.6.180.0400.05020.43
5.6.170.0200.04720.45
5.6.160.0100.04720.49
5.6.150.0030.08718.08
5.6.140.0070.08018.14
5.6.130.0070.08318.21
5.6.120.0030.07021.03
5.6.110.0100.07721.11
5.6.100.0070.08021.13
5.6.90.0100.08320.96
5.6.80.0100.05320.33
5.6.70.3230.04320.52
5.5.350.0070.05720.27
5.5.340.0030.04317.98
5.5.330.0130.05320.46
5.5.320.0070.08320.21
5.5.310.0230.06320.27
5.5.300.0030.07017.97
5.5.290.0100.06317.98
5.5.280.0030.06020.65
5.5.270.0130.08020.79
5.5.260.0070.03720.76
5.5.250.0200.05320.71
5.5.240.0300.07020.26
5.4.450.0270.05019.33
5.4.440.0200.05719.29
5.4.430.0100.06319.51
5.4.420.0170.06319.10
5.4.410.0200.05719.37
5.4.400.1100.06018.77
5.4.390.1530.07018.63
5.4.380.0170.05018.72
5.4.370.0200.04718.46
5.4.360.0270.04018.68
5.4.350.0070.04011.98
5.4.340.0080.03811.97
5.4.320.0060.03712.46
5.4.310.0060.03712.45
5.4.300.0040.03812.46
5.4.290.0080.04112.45
5.4.280.0080.03612.35
5.4.270.0110.03012.35
5.4.260.0040.04112.35
5.4.250.0070.04412.35
5.4.240.0200.05318.55
5.4.230.0170.05018.69
5.4.220.0130.05318.68
5.4.210.0270.05018.74
5.4.200.0270.06018.94
5.4.190.0200.06718.73
5.4.180.0130.06018.83
5.4.170.0130.05718.71
5.4.160.0200.05018.77
5.4.150.0270.04718.86
5.4.140.0130.05016.41
5.4.130.0300.05716.49
5.4.120.0330.03716.23
5.4.110.0270.04316.50
5.4.100.0200.06016.17
5.4.90.0170.04716.28
5.4.80.0200.04716.33
5.4.70.0170.06716.23
5.4.60.0270.03716.45
5.4.50.0270.05716.25
5.4.40.0230.04316.38
5.4.30.0200.05016.39
5.4.20.0400.05716.35
5.4.10.0170.05316.30
5.4.00.0230.05015.76
5.3.290.0080.05112.80
5.3.280.0300.06014.59
5.3.270.0170.05014.74
5.3.260.0170.04314.46
5.3.250.0170.04714.65
5.3.240.0100.05314.36
5.3.230.0170.05314.41
5.3.220.0030.05014.60
5.3.210.0000.05714.27
5.3.200.0070.05714.36
5.3.190.0170.05014.32
5.3.180.0070.05314.33
5.3.170.0100.05314.26
5.3.160.0230.05314.70
5.3.150.0170.04314.39
5.3.140.0070.06014.64
5.3.130.0130.05314.55
5.3.120.0100.05714.24
5.3.110.0170.07014.53
5.3.100.0130.05313.85
5.3.90.0270.06314.03
5.3.80.0170.05013.96
5.3.70.0100.05713.95
5.3.60.0130.05713.85
5.3.50.0130.06014.10
5.3.40.0200.05713.94
5.3.30.0100.06713.91
5.3.20.0230.05313.56
5.3.10.0130.04713.55
5.3.00.0100.05013.34
5.2.170.0170.03310.96
5.2.160.0170.03311.05
5.2.150.0130.05710.87
5.2.140.0100.06311.20
5.2.130.0230.04711.13
5.2.120.0070.04011.12
5.2.110.0100.04311.11
5.2.100.0170.05011.14
5.2.90.0000.04711.20
5.2.80.0130.04710.92
5.2.70.0130.04311.01
5.2.60.0170.04011.00
5.2.50.0170.03311.12
5.2.40.0030.04711.02
5.2.30.0270.02710.87
5.2.20.0100.03710.88
5.2.10.0130.03010.94
5.2.00.0070.05710.80
5.1.60.0070.0379.92
5.1.50.0030.03710.05
5.1.40.0100.03310.03
5.1.30.0070.03710.42
5.1.20.0070.03710.36
5.1.10.0100.03310.02
5.1.00.0070.03310.11
5.0.50.0100.0278.64
5.0.40.0100.0278.34
5.0.30.0070.0438.19
5.0.20.0030.0278.22
5.0.10.0170.0308.27
5.0.00.0070.0438.38
4.4.90.0030.0206.73
4.4.80.0030.0236.73
4.4.70.0170.0206.73
4.4.60.0030.0236.73
4.4.50.0000.0276.73
4.4.40.0030.0506.73
4.4.30.0100.0176.73
4.4.20.0000.0306.73
4.4.10.0030.0236.73
4.4.00.0130.0306.73
4.3.110.0070.0176.64
4.3.100.0070.0176.63
4.3.90.0000.0276.63
4.3.80.0030.0336.63
4.3.70.0030.0236.62
4.3.60.0000.0306.63
4.3.50.0070.0176.66
4.3.40.0030.0476.69
4.3.30.0030.0276.71
4.3.20.0130.0236.70
4.3.10.0000.0236.79
4.3.00.0000.0276.71

preferences:
36.74 ms | 401 KiB | 5 Q