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); var_dump($unpackedUuid); $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.3.10.0090.00316.55
7.3.00.0070.00716.28
7.2.130.0090.00616.93
7.2.120.0120.00616.88
7.2.110.0120.00816.82
7.2.100.0120.00616.93
7.2.90.0120.01216.66
7.2.80.0070.01416.59
7.2.70.0140.00916.88
7.2.60.0070.01016.78
7.2.50.0180.00716.85
7.2.40.0070.01916.96
7.2.30.0140.01016.95
7.2.20.0170.00716.75
7.2.10.0180.00716.59
7.2.00.0070.01218.07
7.1.250.0150.00015.41
7.1.70.0000.00816.93
7.1.60.0090.01519.43
7.1.50.0030.01717.02
7.1.00.0030.05022.43
7.0.200.0410.00714.82
7.0.140.0030.07021.99
7.0.100.0270.04020.13
7.0.90.0130.07719.88
7.0.80.0070.08319.92
7.0.70.0300.07319.94
7.0.60.0230.08719.98
7.0.50.0170.07020.32
7.0.40.0030.08020.11
7.0.30.0130.08020.00
7.0.20.0130.08320.19
7.0.10.0070.04720.08
7.0.00.0070.04019.99
5.6.280.0030.07320.99
5.6.250.0100.05020.70
5.6.240.0130.06320.59
5.6.230.0170.07320.61
5.6.220.0130.06320.53
5.6.210.0070.08320.41
5.6.200.0070.05321.13
5.6.190.0100.08321.11
5.6.180.0000.07321.05
5.6.170.0070.08021.02
5.6.160.0130.04021.01
5.6.150.0130.09021.03
5.6.140.0030.08320.96
5.6.130.0130.07721.08
5.6.120.0100.04721.04
5.6.110.0030.09021.03
5.6.100.0130.08021.02
5.6.90.0000.09320.93
5.6.80.0130.07020.42
5.6.70.0130.07320.32
5.6.60.0100.07320.45
5.6.50.0030.04720.45
5.6.40.0100.07320.49
5.6.30.0100.05020.41
5.6.20.0070.08320.43
5.6.10.0170.07020.31
5.6.00.0100.04320.35
5.5.380.0100.07720.30
5.5.370.0030.05720.36
5.5.360.0130.07720.33
5.5.350.0000.09320.42
5.5.340.0030.08020.74
5.5.330.0130.08320.91
5.5.320.0070.08020.77
5.5.310.0070.08020.92
5.5.300.0130.04320.73
5.5.290.0100.04320.88
5.5.280.0130.07020.88
5.5.270.0130.06320.75
5.5.260.0100.07720.88
5.5.250.0070.06720.59
5.5.240.0100.07020.17
5.5.230.0100.07720.15
5.5.220.0000.08720.30
5.5.210.0070.04720.27
5.5.200.0030.06320.17
5.5.190.0070.05720.23
5.5.180.0200.05720.23
5.5.160.0100.06720.21
5.5.150.0100.05720.14
5.5.140.0100.07720.23
5.5.130.0070.08020.14
5.5.120.0000.06320.12
5.5.110.0030.08020.27
5.5.100.0070.06019.96
5.5.90.0100.06720.07
5.5.80.0130.05320.01
5.5.70.0030.05020.10
5.5.60.0170.04020.15
5.5.50.0130.03020.09
5.5.40.0130.05320.05
5.5.30.0100.03720.14
5.5.20.0100.04320.15
5.5.10.0100.04720.04
5.5.00.0030.07320.03
5.4.450.0030.05019.29
5.4.440.0030.05019.27
5.4.430.0100.08019.41
5.4.420.0070.06719.35
5.4.410.0130.06019.01
5.4.400.0170.07718.98
5.4.390.0070.07319.04
5.4.380.0130.07019.10
5.4.370.0170.04718.98
5.4.360.0000.07719.05
5.4.350.0070.07719.07
5.4.340.0000.08718.98
5.4.320.0170.06718.79
5.4.310.0030.08318.81
5.4.300.0130.06719.07
5.4.290.0000.08018.95
5.4.280.0100.07319.10
5.4.270.0000.08019.12
5.4.260.0100.03718.98
5.4.250.0130.06319.11
5.4.240.0070.04318.89
5.4.230.0070.06319.22
5.4.220.0100.06019.04
5.4.210.0100.05718.78
5.4.200.0030.04318.97
5.4.190.0030.04719.13
5.4.180.0170.06319.09
5.4.170.0170.05019.11
5.4.160.0300.02719.02
5.4.150.0030.05019.03
5.4.140.0030.07016.22
5.4.130.0170.06016.21
5.4.120.0070.07016.31
5.4.110.0070.07316.35
5.4.100.0030.08016.26
5.4.90.0030.06016.22
5.4.80.0030.06316.19
5.4.70.0030.04016.31
5.4.60.0070.07016.18
5.4.50.0130.06716.30
5.4.40.0170.06016.47
5.4.30.0130.06316.27
5.4.20.0100.07016.39
5.4.10.0130.07016.23
5.4.00.0100.07015.64
5.3.290.0070.08014.65
5.3.280.0070.06314.54
5.3.270.0100.05014.61
5.3.260.0030.05314.58
5.3.250.0030.06714.59
5.3.240.0070.07714.47
5.3.230.0100.03714.62
5.3.220.0030.06014.55
5.3.210.0130.07014.56
5.3.200.0070.07314.44
5.3.190.0100.05314.41
5.3.180.0030.07014.58
5.3.170.0100.06714.51
5.3.160.0070.07314.56
5.3.150.0130.06714.55
5.3.140.0130.06714.52
5.3.130.0070.06014.52
5.3.120.0030.04314.50
5.3.110.0030.06714.52
5.3.100.0100.06313.88
5.3.90.0000.06314.02
5.3.80.0100.06713.89
5.3.70.0130.06714.02
5.3.60.0070.05713.98
5.3.50.0070.07013.91
5.3.40.0100.07013.91
5.3.30.0030.07013.78
5.3.20.0070.07313.71
5.3.10.0030.07313.44
5.3.00.0070.07013.51
5.2.170.0100.06011.15
5.2.160.0070.04711.14
5.2.150.0100.06311.14
5.2.140.0030.06311.15
5.2.130.0130.05310.96
5.2.120.0100.05711.14
5.2.110.0070.05011.13
5.2.100.0070.06311.09
5.2.90.0100.05310.90
5.2.80.0030.03711.07
5.2.70.0100.05710.91
5.2.60.0130.06310.91
5.2.50.0030.06311.10
5.2.40.0070.05710.96
5.2.30.0100.03310.94
5.2.20.0030.03310.96
5.2.10.0100.02310.93
5.2.00.0000.03010.67
5.1.60.0000.0279.99
5.1.50.0070.0209.84
5.1.40.0030.02310.05
5.1.30.0030.03010.46
5.1.20.0030.02310.34
5.1.10.0000.0279.91
5.1.00.0030.02310.16
5.0.50.0000.0279.49
5.0.40.0030.0179.49
5.0.30.0030.0309.49
5.0.20.0100.0309.49
5.0.10.0030.0239.49
5.0.00.0030.0709.49
4.4.90.0030.0339.49
4.4.80.0000.0279.49
4.4.70.0000.0179.49
4.4.60.0030.0139.49
4.4.50.0030.0139.49
4.4.40.0070.0239.49
4.4.30.0000.0209.49
4.4.20.0000.0179.49
4.4.10.0000.0209.49
4.4.00.0000.0339.49
4.3.110.0030.0339.49
4.3.100.0000.0379.49
4.3.90.0030.0279.49
4.3.80.0000.0409.49
4.3.70.0070.0339.49
4.3.60.0070.0309.49
4.3.50.0000.0379.49
4.3.40.0030.0539.49
4.3.30.0000.0179.49
4.3.20.0000.0379.49
4.3.10.0000.0339.49
4.3.00.0000.0209.49

preferences:
28.08 ms | 401 KiB | 5 Q