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)[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.10.0030.01414.84
7.4.00.0080.01014.79
7.3.130.0110.00714.61
7.3.120.0050.01214.78
7.3.110.0060.00715.03
7.3.100.0050.01114.97
7.3.90.0030.01014.54
7.3.80.0060.00814.64
7.3.70.0090.00514.78
7.3.60.0080.00614.99
7.3.50.0090.00314.91
7.3.40.0060.00914.74
7.3.30.0090.00614.91
7.3.20.0070.00916.31
7.3.10.0090.00616.64
7.3.00.0060.00916.53
7.2.260.0000.01815.09
7.2.250.0080.01014.85
7.2.240.0090.00914.90
7.2.230.0050.00914.99
7.2.220.0080.00615.01
7.2.210.0080.00615.06
7.2.200.0060.00915.01
7.2.190.0020.00914.99
7.2.180.0030.01214.70
7.2.170.0070.00715.06
7.2.160.0090.00614.91
7.2.150.0060.00916.75
7.2.140.0050.00916.94
7.2.130.0070.00816.74
7.2.120.0100.00616.59
7.2.110.0060.01116.83
7.2.100.0100.00716.79
7.2.90.0090.00916.82
7.2.80.0050.01016.81
7.2.70.0140.00616.79
7.2.60.0130.00616.81
7.2.50.0130.00416.59
7.2.40.0090.01116.87
7.2.30.0080.01016.69
7.2.20.0060.00916.97
7.2.10.0100.00416.90
7.2.00.0080.00817.62
7.1.330.0090.00715.75
7.1.320.0050.01015.83
7.1.310.0020.01015.72
7.1.300.0040.00615.74
7.1.290.0060.00715.80
7.1.280.0030.00815.73
7.1.270.0020.00915.56
7.1.260.0110.00315.70
7.1.250.0050.01015.67
7.1.240.0050.00815.67
7.1.230.0080.00515.55
7.1.220.0030.00915.80
7.1.210.0090.00515.90
7.1.200.0040.01115.67
7.1.190.0030.00915.39
7.1.180.0070.00615.66
7.1.170.0040.00715.66
7.1.160.0080.00615.80
7.1.150.0050.00415.65
7.1.140.0040.00915.74
7.1.130.0100.00315.55
7.1.120.0030.00715.72
7.1.110.0070.00315.91
7.1.100.0090.00515.75
7.1.90.0040.00915.62
7.1.80.0070.00415.71
7.1.70.0040.00616.22
7.1.60.0050.01116.99
7.1.50.0050.00816.23
7.1.40.0050.00915.71
7.1.30.0030.01215.87
7.1.20.0030.01115.78
7.1.10.0060.00715.84
7.1.00.0030.01718.07
7.0.330.0030.01015.57
7.0.320.0040.00815.26
7.0.310.0070.00615.29
7.0.300.0030.01015.34
7.0.290.0050.00915.20
7.0.280.0060.00615.35
7.0.270.0090.00615.51
7.0.260.0100.00315.23
7.0.250.0030.00915.53
7.0.240.0050.00515.45
7.0.230.0040.00815.38
7.0.220.0000.01015.41
7.0.210.0070.00515.40
7.0.200.0090.00415.15
7.0.190.0040.00715.33
7.0.180.0030.01015.40
7.0.170.0040.00915.61
7.0.160.0070.00415.34
7.0.150.0080.00715.27
7.0.140.0110.02517.52
7.0.130.0020.01015.47
7.0.120.0060.00815.49
7.0.110.0060.00715.47
7.0.100.0060.00915.19
7.0.90.0020.01215.51
7.0.80.0060.00615.45
7.0.70.0020.01015.25
7.0.60.0080.01916.71
7.0.50.0090.01416.24
7.0.40.0080.03215.60
7.0.30.0150.02715.60
7.0.20.0120.02815.62
7.0.10.0070.02615.64
7.0.00.0030.03715.63
5.6.400.0030.01014.36
5.6.390.0100.00514.41
5.6.380.0070.00514.36
5.6.370.0070.00814.32
5.6.360.0040.00814.53
5.6.350.0050.00914.15
5.6.340.0060.00914.40
5.6.330.0060.00814.32
5.6.320.0030.01014.39
5.6.310.0080.00714.32
5.6.300.0060.00914.45
5.6.290.0090.00314.28
5.6.280.0080.02816.54
5.6.270.0070.00914.26
5.6.260.0040.01114.23
5.6.250.0090.00614.43
5.6.240.0040.00714.15
5.6.230.0020.01314.36
5.6.220.0090.00314.16
5.6.210.0040.03416.40
5.6.200.0100.03115.62
5.6.190.0050.01916.43
5.6.180.0070.02116.47
5.6.170.0130.02116.32
5.6.160.0070.01416.33
5.6.150.0020.03715.44
5.6.140.0050.02015.52
5.6.130.0100.02915.68
5.6.120.0090.01316.64
5.6.110.0080.02816.66
5.6.100.0080.03016.51
5.6.90.0040.03016.66
5.6.80.0090.02916.16
5.6.70.0160.02816.33
5.6.60.0040.00514.01
5.6.50.0070.00614.13
5.6.40.0060.00814.43
5.6.30.0070.00314.29
5.6.20.0090.00414.44
5.6.10.0080.00514.10
5.6.00.0060.00514.41
5.5.380.0010.00914.36
5.5.370.0110.00414.27
5.5.360.0070.00914.43
5.5.350.0030.03516.37
5.5.340.0030.02815.56
5.5.330.0080.01816.37
5.5.320.0100.02416.35
5.5.310.0120.02516.29
5.5.300.0020.03615.62
5.5.290.0060.02815.44
5.5.280.0090.03116.63
5.5.270.0080.02416.44
5.5.260.0060.03416.54
5.5.250.0050.03516.33
5.5.240.0060.02816.38
5.5.230.0050.00814.14
5.5.220.0070.01014.25
5.5.210.0050.00814.24
5.5.200.0050.00914.16
5.5.190.0040.00914.03
5.5.180.0050.01014.14
5.5.170.0050.01314.13
5.5.160.0080.00514.20
5.5.150.0050.01113.84
5.5.140.0050.01013.83
5.5.130.0100.00314.38
5.5.120.0080.01114.25
5.5.110.0060.00914.35
5.5.100.0030.01014.20
5.5.90.0050.01014.27
5.5.80.0080.00614.09
5.5.70.0030.01214.39
5.5.60.0050.00714.15
5.5.50.0110.00314.11
5.5.40.0080.00314.08
5.5.30.0040.00814.25
5.5.20.0030.01014.14
5.5.10.0030.00714.26
5.5.00.0060.00614.30
5.4.450.0120.02013.81
5.4.440.0110.02113.78
5.4.430.0100.02513.72
5.4.420.0110.02313.97
5.4.410.0130.02413.84
5.4.400.0350.02013.56
5.4.390.0390.02313.54
5.4.380.0100.02713.53
5.4.370.0060.02313.58
5.4.360.0100.01913.52
5.4.350.0050.01611.40
5.4.340.0030.01811.31
5.4.330.0020.00611.08
5.4.320.0050.01811.59
5.4.310.0060.02111.48
5.4.300.0030.01911.55
5.4.290.0030.02411.56
5.4.280.0070.01511.45
5.4.270.0030.01911.50
5.4.260.0060.01611.52
5.4.250.0070.02011.54
5.4.240.0070.02413.56
5.4.230.0030.02613.66
5.4.220.0020.03513.63
5.4.210.0050.03013.54
5.4.200.0050.02113.70
5.4.190.0040.03013.63
5.4.180.0030.02513.57
5.4.170.0030.02313.66
5.4.160.0070.02213.67
5.4.150.0060.02113.68
5.4.140.0090.01812.83
5.4.130.0040.02312.74
5.4.120.0030.02412.81
5.4.110.0040.02212.72
5.4.100.0050.02112.79
5.4.90.0080.01912.87
5.4.80.0010.02412.77
5.4.70.0040.02712.79
5.4.60.0050.02212.73
5.4.50.0060.02112.86
5.4.40.0080.02312.83
5.4.30.0070.02612.79
5.4.20.0050.02012.72
5.4.10.0070.02912.78
5.4.00.0030.02812.64
5.3.290.0060.01611.36
5.3.280.0090.01811.96
5.3.270.0060.02112.00
5.3.260.0040.02512.00
5.3.250.0040.02311.85
5.3.240.0040.02211.94
5.3.230.0150.02111.97
5.3.220.0040.02211.86
5.3.210.0060.02011.78
5.3.200.0090.01911.86
5.3.190.0020.02411.80
5.3.180.0050.02111.93
5.3.170.0010.02511.99
5.3.160.0030.03111.93
5.3.150.0040.02812.03
5.3.140.0030.02611.94
5.3.130.0080.02811.91
5.3.120.0080.02611.86
5.3.110.0020.02411.92
5.3.100.0030.03111.72
5.3.90.0040.02311.65
5.3.80.0060.02011.68
5.3.70.0100.02311.76
5.3.60.0060.02311.70
5.3.50.0060.01711.73
5.3.40.0070.02811.70
5.3.30.0090.02111.65
5.3.20.0020.02211.58
5.3.10.0090.02311.46
5.3.00.0040.02211.52
5.2.170.0100.06011.16
5.2.160.0130.04710.98
5.2.150.0070.04311.08
5.2.140.0100.05711.07
5.2.130.0130.04711.10
5.2.120.0070.04311.13
5.2.110.0130.03711.12
5.2.100.0070.04311.11
5.2.90.0130.05011.20
5.2.80.0070.04710.98
5.2.70.0100.05011.10
5.2.60.0030.06011.21
5.2.50.0100.03711.03
5.2.40.0070.04311.01
5.2.30.0070.06010.99
5.2.20.0070.04710.72
5.2.10.0030.04010.77
5.2.00.0070.03710.93
5.1.60.0030.03710.15
5.1.50.0030.0339.85
5.1.40.0030.03310.13
5.1.30.0100.03010.41
5.1.20.0070.03310.57
5.1.10.0030.04010.13
5.1.00.0030.03710.14
5.0.50.0100.0338.66
5.0.40.0030.0408.45
5.0.30.0030.0408.16
5.0.20.0070.0278.29
5.0.10.0070.0378.01
5.0.00.0030.0438.22
4.4.90.0070.0275.81
4.4.80.0070.0235.74
4.4.70.0000.0235.74
4.4.60.0130.0205.75
4.4.50.0030.0205.80
4.4.40.0000.0335.77
4.4.30.0030.0205.74
4.4.20.0100.0205.95
4.4.10.0030.0205.96
4.4.00.0030.0435.95
4.3.110.0030.0205.95
4.3.100.0030.0205.95
4.3.90.0030.0235.95
4.3.80.0030.0335.95
4.3.70.0070.0175.95
4.3.60.0030.0205.95
4.3.50.0070.0175.95
4.3.40.0030.0305.95
4.3.30.0000.0235.95
4.3.20.0000.0205.95
4.3.10.0130.0205.95
4.3.00.0070.0176.71

preferences:
37.88 ms | 401 KiB | 5 Q