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) ); $uuid = 0; $packedUuid = pack('H*', $uuid); $unpackedUuid = unpack('H*', $packedUuid)[1]; $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.4.00.0000.01814.71
7.3.120.0030.01314.83
7.3.110.0000.01415.09
7.3.100.0060.00914.67
7.3.90.0030.00914.80
7.3.80.0100.00714.78
7.3.70.0060.01014.74
7.3.60.0090.00614.74
7.3.50.0060.00614.69
7.3.40.0070.01115.00
7.3.30.0130.00314.88
7.3.20.0030.01316.63
7.3.10.0070.01016.38
7.3.00.0040.01116.62
7.2.250.0040.01515.18
7.2.240.0000.01614.82
7.2.230.0070.00715.20
7.2.220.0110.00715.10
7.2.210.0100.00314.84
7.2.200.0100.00315.23
7.2.190.0110.00415.09
7.2.180.0000.01515.05
7.2.170.0030.01414.98
7.2.160.0120.00614.95
7.2.150.0060.01216.69
7.2.140.0120.00316.88
7.2.130.0060.00616.96
7.2.120.0140.00116.79
7.2.110.0100.00516.70
7.2.100.0100.00616.63
7.2.90.0110.00316.77
7.2.80.0100.00716.91
7.2.70.0080.00717.03
7.2.60.0090.00616.95
7.2.50.0060.01216.86
7.2.40.0080.00816.99
7.2.30.0120.00416.99
7.2.20.0100.00516.88
7.2.10.0150.00216.94
7.2.00.0080.00717.03
7.1.330.0100.00615.99
7.1.320.0000.01415.82
7.1.310.0110.00415.79
7.1.300.0060.00915.88
7.1.290.0090.00015.96
7.1.280.0120.00315.84
7.1.270.0090.00615.68
7.1.260.0060.00915.76
7.1.250.0070.00415.88
7.1.240.0070.00515.76
7.1.230.0050.00815.81
7.1.220.0070.00815.82
7.1.210.0060.00615.76
7.1.200.0080.00715.71
7.1.190.0050.01015.79
7.1.180.0040.01115.92
7.1.170.0050.00915.58
7.1.160.0070.00715.71
7.1.150.0110.00615.71
7.1.140.0070.00515.59
7.1.130.0060.01015.83
7.1.120.0120.00315.63
7.1.110.0120.00415.84
7.1.100.0090.00515.89
7.1.90.0050.00915.79
7.1.80.0090.00515.54
7.1.70.0060.00716.15
7.1.60.0050.01116.94
7.1.50.0050.00916.16
7.1.40.0020.01115.89
7.1.30.0050.00615.93
7.1.20.0070.00515.73
7.1.10.0050.00715.73
7.1.00.0040.03117.89
7.0.330.0060.00915.41
7.0.320.0100.00615.31
7.0.310.0090.00915.33
7.0.300.0090.00715.50
7.0.290.0090.00615.44
7.0.280.0070.00815.52
7.0.270.0090.00515.30
7.0.260.0060.00815.52
7.0.250.0060.00815.23
7.0.240.0110.00515.36
7.0.230.0070.00715.47
7.0.220.0060.00715.35
7.0.210.0060.00815.41
7.0.200.0070.00615.85
7.0.190.0080.00615.31
7.0.180.0080.00415.42
7.0.170.0050.01015.41
7.0.160.0070.00415.46
7.0.150.0010.01115.38
7.0.140.0090.02717.67
7.0.130.0030.00915.26
7.0.120.0020.01115.38
7.0.110.0070.00415.47
7.0.100.0090.02816.93
7.0.90.0030.03616.98
7.0.80.0120.01816.84
7.0.70.0070.01916.85
7.0.60.0110.03016.90
7.0.50.0120.01816.98
7.0.40.0090.01615.60
7.0.30.0110.02615.59
7.0.20.0050.02815.65
7.0.10.0070.02715.63
7.0.00.0050.01715.58
5.6.400.0140.00014.59
5.6.390.0080.00814.09
5.6.380.0040.01014.26
5.6.370.0100.00714.47
5.6.360.0080.00814.38
5.6.350.0070.00814.40
5.6.340.0090.00714.21
5.6.330.0070.00714.32
5.6.320.0100.00414.52
5.6.310.0080.00814.46
5.6.300.0090.00514.46
5.6.290.0080.00814.43
5.6.280.0060.02816.58
5.6.270.0060.00814.25
5.6.260.0060.00714.41
5.6.250.0060.03616.47
5.6.240.0100.03116.48
5.6.230.0090.01716.38
5.6.220.0100.02616.22
5.6.210.0050.02516.37
5.6.200.0090.02516.59
5.6.190.0110.03316.65
5.6.180.0110.02116.43
5.6.170.0020.03816.58
5.6.160.0080.02316.59
5.6.150.0070.01816.70
5.6.140.0110.01816.54
5.6.130.0060.03016.53
5.6.120.0110.03016.54
5.6.110.0100.03216.53
5.6.100.0090.02916.61
5.6.90.0110.01916.58
5.6.80.0110.03016.30
5.6.70.0030.02916.25
5.6.60.0130.02516.34
5.6.50.0080.02116.33
5.6.40.0090.02916.28
5.6.30.0080.01916.38
5.6.20.0070.02016.32
5.6.10.0080.01716.24
5.6.00.0120.01816.31
5.5.380.0140.02415.28
5.5.370.0080.02415.33
5.5.360.0100.01515.27
5.5.350.0110.02215.33
5.5.340.0100.03215.23
5.5.330.0090.01815.40
5.5.320.0070.03615.38
5.5.310.0110.02615.32
5.5.300.0100.01915.46
5.5.290.0070.03315.30
5.5.280.0100.02915.47
5.5.270.0040.02915.32
5.5.260.0080.02315.54
5.5.250.0090.02815.35
5.5.240.0120.02415.11
5.5.230.0060.02115.18
5.5.220.0040.03215.04
5.5.210.0050.02615.25
5.5.200.0090.01715.22
5.5.190.0090.01915.13
5.5.180.0070.03015.12
5.5.170.0140.00014.28
5.5.160.0080.02915.13
5.5.150.0020.02315.02
5.5.140.0080.03415.18
5.5.130.0060.02215.20
5.5.120.0070.03215.30
5.5.110.0040.02215.26
5.5.100.0060.01815.07
5.5.90.0070.02615.18
5.5.80.0080.02715.12
5.5.70.0050.02715.02
5.5.60.0080.02015.18
5.5.50.0110.01815.07
5.5.40.0100.02915.07
5.5.30.0070.02815.19
5.5.20.0050.01815.16
5.5.10.0120.02315.13
5.5.00.0050.02615.16
5.4.450.0030.03113.96
5.4.440.0020.03013.81
5.4.430.0040.01913.83
5.4.420.0100.01613.88
5.4.410.0090.02413.88
5.4.400.0060.01613.72
5.4.390.0070.02313.61
5.4.380.0080.02613.57
5.4.370.0050.01813.67
5.4.360.0070.01513.70
5.4.350.0090.01513.75
5.4.340.0060.03113.80
5.4.330.0040.00811.08
5.4.320.0080.03013.66
5.4.310.0060.02713.73
5.4.300.0060.01913.71
5.4.290.0070.02113.73
5.4.280.0100.01913.70
5.4.270.0050.01813.64
5.4.260.0060.02613.77
5.4.250.0080.01913.79
5.4.240.0080.02413.73
5.4.230.0050.02413.70
5.4.220.0070.01513.61
5.4.210.0090.02113.82
5.4.200.0050.02813.70
5.4.190.0070.02813.67
5.4.180.0050.01913.71
5.4.170.0090.02813.72
5.4.160.0080.01613.75
5.4.150.0100.02313.58
5.4.140.0100.01612.92
5.4.130.0060.02612.88
5.4.120.0130.02112.83
5.4.110.0090.01412.78
5.4.100.0090.01712.82
5.4.90.0080.01712.79
5.4.80.0080.02512.69
5.4.70.0010.02512.68
5.4.60.0030.01712.77
5.4.50.0050.01512.65
5.4.40.0060.01612.78
5.4.30.0050.01712.68
5.4.20.0050.01412.74
5.4.10.0070.01612.76
5.4.00.0030.01612.59
5.3.290.0040.02012.02
5.3.280.0090.02511.91
5.3.270.0060.01611.98
5.3.260.0080.02811.94
5.3.250.0100.02611.95
5.3.240.0030.02911.84
5.3.230.0050.02911.96
5.3.220.0080.02711.89
5.3.210.0080.01411.85
5.3.200.0030.02211.88
5.3.190.0070.02211.84
5.3.180.0070.02611.96
5.3.170.0050.02911.98
5.3.160.0020.01911.95
5.3.150.0070.01411.88
5.3.140.0110.01111.96
5.3.130.0030.01511.96
5.3.120.0060.01611.96
5.3.110.0020.01911.96
5.3.100.0060.01411.68
5.3.90.0110.01111.79
5.3.80.0050.01511.67
5.3.70.0090.01311.68
5.3.60.0070.01511.78
5.3.50.0070.01211.70
5.3.40.0030.01711.69
5.3.30.0040.01611.71
5.3.20.0030.01611.55
5.3.10.0060.01211.53
5.3.00.0060.01311.49
5.2.170.0010.01811.50
5.2.160.0040.01611.50
5.2.150.0090.01311.50
5.2.140.0030.01811.50
5.2.130.0030.01811.50
5.2.120.0030.01711.50
5.2.110.0030.01811.50
5.2.100.0030.02211.50
5.2.90.0060.01511.50
5.2.80.0060.01611.50
5.2.70.0040.01711.50
5.2.60.0020.02011.50
5.2.50.0040.01811.50
5.2.40.0060.01511.50
5.2.30.0090.01211.50
5.2.20.0040.01511.50
5.2.10.0060.01511.50
5.2.00.0050.01611.50
5.1.60.0040.01411.50
5.1.50.0050.01011.50
5.1.40.0090.01211.50
5.1.30.0020.01611.50
5.1.20.0030.01811.50
5.1.10.0030.01711.50
5.1.00.0030.01311.50
5.0.50.0030.02111.50
5.0.40.0050.01011.50
5.0.30.0020.01811.50
5.0.20.0050.01011.50
5.0.10.0060.01211.50
5.0.00.0040.01611.50
4.4.90.0000.01111.50
4.4.80.0030.00711.50
4.4.70.0040.01011.50
4.4.60.0040.00811.50
4.4.50.0050.00511.50
4.4.40.0040.01111.50
4.4.30.0020.01011.50
4.4.20.0020.01111.50
4.4.10.0020.01111.50
4.4.00.0030.01211.50
4.3.110.0030.00711.50
4.3.100.0060.00711.50
4.3.90.0020.01111.50
4.3.80.0030.01511.50
4.3.70.0040.00811.50
4.3.60.0020.01011.50
4.3.50.0070.00711.50
4.3.40.0000.01611.50
4.3.30.0020.01011.50
4.3.20.0040.00811.50
4.3.10.0040.00811.50
4.3.00.0040.00711.50

preferences:
42.09 ms | 400 KiB | 5 Q