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[0]; 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.4.10.0090.00615.10
7.4.00.0120.00615.05
7.3.130.0060.00914.89
7.3.120.0120.00214.97
7.3.110.0060.01014.83
7.3.100.0070.00514.80
7.3.90.0050.01115.05
7.3.80.0030.01114.90
7.3.70.0060.00914.88
7.3.60.0080.00814.94
7.3.50.0070.00914.82
7.3.40.0070.00714.82
7.3.30.0080.00514.91
7.3.20.0090.00616.60
7.3.10.0050.00716.59
7.3.00.0050.01016.63
7.2.260.0130.00314.93
7.2.250.0120.00515.10
7.2.240.0060.01115.19
7.2.230.0060.00614.79
7.2.220.0060.00815.31
7.2.210.0050.01114.71
7.2.200.0080.00715.10
7.2.190.0050.01014.93
7.2.180.0080.00614.93
7.2.170.0060.00914.96
7.2.160.0070.00314.78
7.2.150.0060.00917.13
7.2.140.0030.01016.71
7.2.130.0070.00716.98
7.2.120.0060.00616.96
7.2.110.0070.00717.00
7.2.100.0070.01116.91
7.2.90.0090.00617.01
7.2.80.0100.00716.86
7.2.70.0060.00917.02
7.2.60.0040.01116.89
7.2.50.0070.00717.19
7.2.40.0070.00716.66
7.2.30.0070.00717.00
7.2.20.0060.00616.94
7.2.10.0030.01016.96
7.2.00.0060.01018.13
7.1.330.0070.00915.78
7.1.320.0090.00315.73
7.1.310.0070.00715.94
7.1.300.0050.00915.80
7.1.290.0000.01515.73
7.1.280.0060.00815.93
7.1.270.0070.00715.79
7.1.260.0060.00815.80
7.1.250.0050.00315.60
7.1.240.0070.01115.86
7.1.230.0030.01015.89
7.1.220.0100.00615.76
7.1.210.0040.00815.61
7.1.200.0030.01015.93
7.1.190.0040.01215.84
7.1.180.0070.01015.57
7.1.170.0070.00715.98
7.1.160.0080.00315.61
7.1.150.0070.00715.97
7.1.140.0060.00915.86
7.1.130.0030.01015.87
7.1.120.0030.01015.56
7.1.110.0080.00815.95
7.1.100.0000.01015.83
7.1.90.0030.00915.89
7.1.80.0000.01115.88
7.1.70.0070.00416.52
7.1.60.0060.01117.64
7.1.50.0050.01316.31
7.1.40.0040.01116.03
7.1.30.0070.00716.00
7.1.20.0000.01016.00
7.1.10.0030.01015.73
7.1.00.0030.04419.14
7.0.330.0060.00915.18
7.0.320.0070.00715.41
7.0.310.0060.00915.57
7.0.300.0090.00415.18
7.0.290.0040.01115.25
7.0.280.0100.00315.30
7.0.270.0000.01315.42
7.0.260.0110.00415.27
7.0.250.0070.00715.21
7.0.240.0060.00615.45
7.0.230.0030.01015.49
7.0.220.0040.01115.68
7.0.210.0060.00615.55
7.0.200.0130.00215.13
7.0.190.0040.01115.30
7.0.180.0070.00715.45
7.0.170.0060.00615.24
7.0.160.0040.00715.18
7.0.150.0110.00415.51
7.0.140.0070.04018.74
7.0.130.0030.01015.55
7.0.120.0030.00715.14
7.0.110.0000.01715.56
7.0.100.0090.00615.23
7.0.90.0000.01515.50
7.0.80.0030.01015.47
7.0.70.0030.01015.11
7.0.60.0080.04417.82
7.0.50.0070.03216.73
7.0.40.0020.03916.71
7.0.30.0230.03816.88
7.0.20.0170.03016.67
7.0.10.0150.03516.64
7.0.00.0070.03516.92
5.6.400.0070.00714.24
5.6.390.0080.00614.50
5.6.380.0030.01014.51
5.6.370.0040.01114.45
5.6.360.0040.01113.96
5.6.350.0030.00614.66
5.6.340.0030.01014.19
5.6.330.0060.00614.51
5.6.320.0030.01014.34
5.6.310.0040.01114.17
5.6.300.0030.01214.47
5.6.290.0060.00314.45
5.6.280.0040.04017.60
5.6.270.0130.00014.33
5.6.260.0000.01314.24
5.6.250.0060.00614.28
5.6.240.0030.00714.25
5.6.230.0070.00714.38
5.6.220.0060.00614.30
5.6.210.0030.04817.53
5.6.200.0100.03516.18
5.6.190.0020.02717.19
5.6.180.0130.04417.36
5.6.170.0150.02217.50
5.6.160.0140.04217.35
5.6.150.0050.04716.12
5.6.140.0030.02616.23
5.6.130.0070.04616.28
5.6.120.0100.03417.73
5.6.110.0050.04917.63
5.6.100.0130.01817.61
5.6.90.0050.02317.47
5.6.80.0100.03617.27
5.6.70.0260.03017.37
5.6.60.0090.00614.26
5.6.50.0040.00714.24
5.6.40.0120.00314.55
5.6.30.0070.00414.26
5.6.20.0030.01514.29
5.6.10.0040.00814.00
5.6.00.0050.00514.27
5.5.380.0130.00314.29
5.5.370.0140.00014.38
5.5.360.0060.01314.18
5.5.350.0090.04317.46
5.5.340.0090.03315.99
5.5.330.0080.04017.22
5.5.320.0210.03017.08
5.5.310.0120.03517.28
5.5.300.0050.03916.17
5.5.290.0090.02516.14
5.5.280.0030.05117.63
5.5.270.0080.03317.63
5.5.260.0130.03017.48
5.5.250.0120.02717.33
5.5.240.0030.03717.17
5.5.230.0100.00314.07
5.5.220.0000.01513.89
5.5.210.0030.01014.27
5.5.200.0100.00714.22
5.5.190.0000.01514.30
5.5.180.0100.00314.11
5.5.170.0060.01214.01
5.5.160.0070.00714.01
5.5.150.0030.01213.97
5.5.140.0040.01114.26
5.5.130.0030.01014.02
5.5.120.0120.00314.33
5.5.110.0140.00314.41
5.5.100.0040.01114.23
5.5.90.0140.00014.18
5.5.80.0090.00614.35
5.5.70.0000.01214.06
5.5.60.0040.01114.37
5.5.50.0090.00613.95
5.5.40.0030.00713.98
5.5.30.0060.00614.00
5.5.20.0130.00314.15
5.5.10.0070.00414.32
5.5.00.0000.01514.01
5.4.450.0400.03015.86
5.4.440.0120.03215.88
5.4.430.0100.03315.70
5.4.420.0120.03215.94
5.4.410.0140.02915.66
5.4.400.0630.02515.58
5.4.390.0600.03415.44
5.4.380.0080.03715.51
5.4.370.0110.02715.45
5.4.360.0150.02615.45
5.4.350.0150.02512.15
5.4.340.0180.02412.15
5.4.330.0030.00512.31
5.4.320.0050.03012.39
5.4.310.0040.02612.39
5.4.300.0040.02412.39
5.4.290.0080.02312.39
5.4.280.0030.02312.34
5.4.270.0050.02612.33
5.4.260.0080.02812.34
5.4.250.0040.02712.33
5.4.240.0030.03115.65
5.4.230.0060.03115.61
5.4.220.0020.03415.57
5.4.210.0120.02415.50
5.4.200.0030.03115.60
5.4.190.0090.03415.54
5.4.180.0100.03015.54
5.4.170.0110.03815.62
5.4.160.0080.03115.63
5.4.150.0080.03115.51
5.4.140.0060.02714.24
5.4.130.0080.02714.24
5.4.120.0070.02714.26
5.4.110.0090.03414.37
5.4.100.0050.03014.34
5.4.90.0020.03314.33
5.4.80.0010.03114.38
5.4.70.0080.02514.35
5.4.60.0070.03214.34
5.4.50.0000.03414.37
5.4.40.0020.03014.29
5.4.30.0060.02514.32
5.4.20.0030.03014.26
5.4.10.0090.02314.38
5.4.00.0090.02413.98
5.3.290.0080.02212.55
5.3.280.0060.02913.35
5.3.270.0070.03713.51
5.3.260.0020.03213.36
5.3.250.0050.02813.47
5.3.240.0080.02913.46
5.3.230.0040.03913.39
5.3.220.0100.02313.39
5.3.210.0050.02813.45
5.3.200.0070.03713.29
5.3.190.0110.03513.45
5.3.180.0050.02513.44
5.3.170.0050.02813.46
5.3.160.0100.02513.49
5.3.150.0020.03213.37
5.3.140.0100.02313.45
5.3.130.0050.02813.37
5.3.120.0030.02813.38
5.3.110.0050.02813.44
5.3.100.0020.03113.18
5.3.90.0050.02613.11
5.3.80.0080.02613.13
5.3.70.0020.02913.09
5.3.60.0130.01813.12
5.3.50.0030.03013.18
5.3.40.0040.02713.08
5.3.30.0080.02513.04
5.3.20.0060.02612.96
5.3.10.0010.03112.83
5.3.00.0070.02812.87
5.2.170.0070.04011.25
5.2.160.0070.05711.15
5.2.150.0100.03711.15
5.2.140.0100.04010.98
5.2.130.0030.04011.14
5.2.120.0070.05711.12
5.2.110.0030.04010.96
5.2.100.0070.04011.26
5.2.90.0000.04311.13
5.2.80.0070.04011.11
5.2.70.0070.04011.12
5.2.60.0000.05311.17
5.2.50.0130.03311.02
5.2.40.0030.04011.03
5.2.30.0030.04010.86
5.2.20.0100.03710.97
5.2.10.0030.04010.96
5.2.00.0030.04010.80
5.1.60.0100.0279.97
5.1.50.0030.04010.05
5.1.40.0030.03310.08
5.1.30.0100.03010.42
5.1.20.0000.05010.34
5.1.10.0030.03710.13
5.1.00.0070.03310.22
5.0.50.0000.0308.51
5.0.40.0030.0408.61
5.0.30.0000.0478.46
5.0.20.0000.0278.39
5.0.10.0000.0308.27
5.0.00.0030.0408.20
4.4.90.0000.0235.79
4.4.80.0030.0205.87
4.4.70.0000.0235.86
4.4.60.0030.0205.88
4.4.50.0030.0205.80
4.4.40.0070.0335.91
4.4.30.0030.0205.78
4.4.20.0030.0205.76
4.4.10.0070.0175.93
4.4.00.0000.0335.81
4.3.110.0000.0235.80
4.3.100.0030.0205.72
4.3.90.0030.0235.77
4.3.80.0030.0335.67
4.3.70.0100.0105.78
4.3.60.0030.0205.68
4.3.50.0070.0175.73
4.3.40.0030.0305.75
4.3.30.0000.0234.44
4.3.20.0030.0204.47
4.3.10.0070.0174.48
4.3.00.0130.0236.71

preferences:
33.4 ms | 401 KiB | 5 Q