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)[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.0070.01315.13
7.4.00.0090.00615.00
7.3.130.0030.01414.92
7.3.120.0100.01015.19
7.3.110.0070.01115.01
7.3.100.0030.00914.91
7.3.90.0090.00914.70
7.3.80.0060.01015.14
7.3.70.0080.00314.66
7.3.60.0060.00914.92
7.3.50.0060.00914.69
7.3.40.0110.00714.68
7.3.30.0090.00614.99
7.3.20.0090.00616.76
7.3.10.0030.01016.67
7.3.00.0040.01116.60
7.2.260.0100.00715.29
7.2.250.0100.00614.62
7.2.240.0070.01115.08
7.2.230.0060.00815.32
7.2.220.0040.01115.36
7.2.210.0060.01015.17
7.2.200.0040.00815.24
7.2.190.0050.00515.11
7.2.180.0040.01115.04
7.2.170.0070.01015.23
7.2.160.0000.01414.87
7.2.150.0040.00816.97
7.2.140.0000.01616.86
7.2.130.0080.00716.79
7.2.120.0040.00916.82
7.2.110.0070.00816.63
7.2.100.0050.01016.61
7.2.90.0090.00416.73
7.2.80.0080.00616.78
7.2.70.0030.01116.79
7.2.60.0080.00816.84
7.2.50.0040.01316.66
7.2.40.0070.01016.92
7.2.30.0030.00816.85
7.2.20.0070.00716.90
7.2.10.0050.00916.95
7.2.00.0070.00617.71
7.1.330.0120.00315.68
7.1.320.0000.01415.96
7.1.310.0150.00015.92
7.1.300.0030.01115.97
7.1.290.0030.00615.99
7.1.280.0070.00715.59
7.1.270.0060.00615.82
7.1.260.0070.00715.86
7.1.250.0020.00915.43
7.1.240.0110.00515.70
7.1.230.0150.00115.81
7.1.220.0050.00515.78
7.1.210.0040.01015.71
7.1.200.0070.00715.62
7.1.190.0070.00615.71
7.1.180.0050.00915.64
7.1.170.0070.00715.62
7.1.160.0050.01015.60
7.1.150.0020.00815.74
7.1.140.0060.00515.69
7.1.130.0050.00615.72
7.1.120.0030.00915.86
7.1.110.0020.01115.63
7.1.100.0040.01015.63
7.1.90.0050.01215.78
7.1.80.0060.00715.78
7.1.70.0070.00616.25
7.1.60.0040.01317.00
7.1.50.0080.00816.04
7.1.40.0090.00815.62
7.1.30.0110.00515.70
7.1.20.0100.00615.82
7.1.10.0020.00915.69
7.1.00.0010.02017.91
7.0.330.0070.00615.29
7.0.320.0050.00815.32
7.0.310.0030.00815.35
7.0.300.0060.00615.35
7.0.290.0000.01015.38
7.0.280.0060.00415.23
7.0.270.0050.00715.30
7.0.260.0060.00815.27
7.0.250.0060.00815.38
7.0.240.0050.00915.33
7.0.230.0030.00915.34
7.0.220.0100.00615.27
7.0.210.0010.01315.17
7.0.200.0110.00615.14
7.0.190.0020.01015.04
7.0.180.0120.00315.27
7.0.170.0090.00515.29
7.0.160.0050.00515.40
7.0.150.0060.00915.24
7.0.140.0060.02717.52
7.0.130.0080.00515.35
7.0.120.0080.00715.26
7.0.110.0050.00715.25
7.0.100.0060.00615.15
7.0.90.0060.00815.25
7.0.80.0060.00415.24
7.0.70.0050.00715.43
7.0.60.0030.01916.94
7.0.50.0070.03116.20
7.0.40.0060.02515.45
7.0.30.0090.01815.59
7.0.20.0130.02815.55
7.0.10.0160.01515.63
7.0.00.0120.02915.54
5.6.400.0040.01114.47
5.6.390.0060.00914.27
5.6.380.0030.00714.29
5.6.370.0070.00814.17
5.6.360.0040.00814.12
5.6.350.0050.01014.30
5.6.340.0090.00514.24
5.6.330.0050.00814.30
5.6.320.0050.01014.23
5.6.310.0080.00714.13
5.6.300.0070.00414.16
5.6.290.0030.01014.30
5.6.280.0070.02816.57
5.6.270.0050.00714.21
5.6.260.0090.00414.36
5.6.250.0080.00514.48
5.6.240.0090.00514.22
5.6.230.0010.01114.13
5.6.220.0020.00914.23
5.6.210.0060.03116.33
5.6.200.0040.02115.49
5.6.190.0090.02716.33
5.6.180.0100.01916.29
5.6.170.0120.02116.37
5.6.160.0080.03016.23
5.6.150.0070.03115.68
5.6.140.0060.03115.44
5.6.130.0070.02815.50
5.6.120.0010.03816.63
5.6.110.0070.01816.53
5.6.100.0100.03016.44
5.6.90.0070.02816.39
5.6.80.0090.02616.22
5.6.70.0160.01516.29
5.6.60.0090.00614.15
5.6.50.0010.01014.19
5.6.40.0020.00814.23
5.6.30.0070.00714.07
5.6.20.0030.01014.14
5.6.10.0030.01214.16
5.6.00.0010.01114.21
5.5.380.0040.00412.51
5.5.370.0050.00812.44
5.5.360.0070.00512.72
5.5.350.0050.02515.13
5.5.340.0040.02514.43
5.5.330.0030.02114.97
5.5.320.0100.02415.14
5.5.310.0080.02515.15
5.5.300.0080.02114.55
5.5.290.0060.01614.35
5.5.280.0040.02115.41
5.5.270.0070.03115.43
5.5.260.0090.03215.31
5.5.250.0060.03415.29
5.5.240.0070.02615.05
5.5.230.0070.00412.67
5.5.220.0050.00512.60
5.5.210.0020.01312.52
5.5.200.0050.00812.59
5.5.190.0040.00612.36
5.5.180.0060.00612.63
5.5.170.0060.00812.63
5.5.160.0070.00312.56
5.5.150.0070.00812.64
5.5.140.0040.00912.62
5.5.130.0030.00612.54
5.5.120.0040.00512.41
5.5.110.0030.00812.56
5.5.100.0070.00312.57
5.5.90.0050.00712.65
5.5.80.0060.00512.41
5.5.70.0050.00812.76
5.5.60.0030.00812.59
5.5.50.0080.00512.34
5.5.40.0060.00712.47
5.5.30.0060.00512.48
5.5.20.0050.00712.63
5.5.10.0070.00712.56
5.5.00.0020.00912.46
5.4.450.0120.02914.15
5.4.440.0130.02614.02
5.4.430.0090.02913.94
5.4.420.0110.03014.12
5.4.410.0130.02513.90
5.4.400.0090.02013.94
5.4.390.0080.02413.98
5.4.380.0060.02113.98
5.4.370.0090.02714.00
5.4.360.0140.02513.83
5.4.350.0110.02813.95
5.4.340.0150.02513.92
5.4.330.0050.00411.34
5.4.320.0110.02013.96
5.4.310.0110.01613.92
5.4.300.0110.02613.92
5.4.290.0090.02613.92
5.4.280.0100.02913.85
5.4.270.0110.03013.83
5.4.260.0090.03013.90
5.4.250.0110.02713.86
5.4.240.0100.02613.92
5.4.230.0130.02113.93
5.4.220.0120.02913.82
5.4.210.0130.02813.90
5.4.200.0130.01613.85
5.4.190.0120.02613.97
5.4.180.0080.03413.83
5.4.170.0080.02013.85
5.4.160.0120.02613.87
5.4.150.0110.02813.91
5.4.140.0120.01512.99
5.4.130.0110.02013.01
5.4.120.0140.01613.01
5.4.110.0090.02813.03
5.4.100.0130.02313.04
5.4.90.0110.02212.92
5.4.80.0140.01912.97
5.4.70.0090.02113.04
5.4.60.0100.02713.00
5.4.50.0110.02313.04
5.4.40.0150.01713.13
5.4.30.0190.02013.03
5.4.20.0140.02213.04
5.4.10.0150.02013.04
5.4.00.0120.02712.88
5.3.290.0090.01612.52
5.3.280.0100.02512.52
5.3.270.0100.02912.52
5.3.260.0100.03012.52
5.3.250.0070.01912.52
5.3.240.0110.02012.52
5.3.230.0100.02412.52
5.3.220.0100.03112.52
5.3.210.0110.02012.52
5.3.200.0120.02912.52
5.3.190.0080.02312.52
5.3.180.0120.02012.52
5.3.170.0160.02412.52
5.3.160.0100.01912.52
5.3.150.0130.02412.52
5.3.140.0160.02112.52
5.3.130.0090.02212.52
5.3.120.0130.02312.52
5.3.110.0110.02312.52
5.3.100.0090.02312.52
5.3.90.0070.02012.52
5.3.80.0120.02412.52
5.3.70.0100.02412.52
5.3.60.0070.02312.52
5.3.50.0120.02212.52
5.3.40.0090.02312.52
5.3.30.0060.02212.52
5.3.20.0110.02512.52
5.3.10.0110.02512.52
5.3.00.0110.02412.52
5.2.170.0100.01912.89
5.2.160.0120.02912.89
5.2.150.0080.03512.89
5.2.140.0080.01912.89
5.2.130.0150.03012.89
5.2.120.0060.02612.89
5.2.110.0100.02212.89
5.2.100.0140.02512.89
5.2.90.0120.03212.89
5.2.80.0100.02112.89
5.2.70.0110.02912.89
5.2.60.0190.02512.89
5.2.50.0100.03312.89
5.2.40.0060.03412.89
5.2.30.0120.02812.89
5.2.20.0050.03212.89
5.2.10.0030.02712.89
5.2.00.0080.01812.89
5.1.60.0100.02812.89
5.1.50.0080.02112.89
5.1.40.0080.02812.89
5.1.30.0120.02712.89
5.1.20.0120.02712.89
5.1.10.0120.02512.89
5.1.00.0130.02012.89
5.0.50.0030.02512.89
5.0.40.0050.01512.89
5.0.30.0080.03012.89
5.0.20.0070.01812.89
5.0.10.0050.01212.89
5.0.00.0040.01912.89
4.4.90.0070.01412.89
4.4.80.0030.01612.89
4.4.70.0050.01712.89
4.4.60.0050.01312.89
4.4.50.0030.01412.89
4.4.40.0050.01312.89
4.4.30.0070.01812.89
4.4.20.0050.02012.89
4.4.10.0080.01312.89
4.4.00.0020.01912.89
4.3.110.0060.01012.89
4.3.100.0050.01712.89
4.3.90.0050.01412.89
4.3.80.0050.01412.89
4.3.70.0030.01912.89
4.3.60.0070.00512.89
4.3.50.0080.01812.89
4.3.40.0030.01912.89
4.3.30.0030.02012.89
4.3.20.0070.01612.89
4.3.10.0030.02012.89
4.3.00.0050.01512.89

preferences:
36.05 ms | 400 KiB | 5 Q