3v4l.org

run code in 300+ PHP versions simultaneously
<?php mt_srand(42); for ($i = 0; $i < 20; $i++) { $key = generate_key(); $len = strlen($key); echo "{$key} {$len}\n"; } function generate_key() { return base64_urlencode(rand_buffer(48)); } function base64_urlencode($buf) { return str_replace( array('+', '/', '='), array('-', '_', ''), base64_encode($buf) ); } function rand_buffer($n) { if (function_exists("openssl_random_pseudo_bytes")) { return openssl_random_pseudo_bytes($n); } $buf = ""; for ($i = 0; $i < $n; $i++) { $buf .= chr(mt_rand(0, 255)); } return $buf; }

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.0040.01214.70
7.4.00.0090.00915.17
7.3.130.0100.00714.85
7.3.120.0030.01715.05
7.3.110.0030.01614.91
7.3.100.0090.00614.80
7.3.90.0090.00915.01
7.3.80.0060.00915.03
7.3.70.0060.01214.94
7.3.60.0070.00315.04
7.3.50.0040.00814.75
7.3.40.0090.00914.91
7.3.30.0000.01414.99
7.3.20.0000.00916.61
7.3.10.0090.00716.50
7.3.00.0100.00316.40
7.2.260.0030.01015.09
7.2.250.0030.01415.24
7.2.240.0090.00414.63
7.2.230.0130.00315.37
7.2.220.0130.00315.12
7.2.210.0100.01014.97
7.2.200.0040.01515.02
7.2.190.0070.00715.14
7.2.180.0130.00315.30
7.2.170.0050.00515.16
7.2.160.0030.01714.89
7.2.150.0060.00917.14
7.2.140.0070.01017.01
7.2.130.0090.00616.63
7.2.120.0120.00616.81
7.2.110.0110.00716.53
7.2.100.0080.00916.53
7.2.90.0080.00616.62
7.2.80.0040.01116.79
7.2.70.0110.01316.81
7.2.60.0100.00516.74
7.2.50.0120.00816.89
7.2.40.0120.00916.77
7.2.30.0090.01216.62
7.2.20.0130.00816.80
7.2.10.0100.00616.66
7.2.00.0120.00616.56
7.1.330.0040.01115.53
7.1.320.0070.00715.75
7.1.310.0090.00615.92
7.1.300.0040.00715.88
7.1.290.0090.00615.55
7.1.280.0000.01215.94
7.1.270.0070.00715.84
7.1.260.0000.01015.87
7.1.250.0060.01015.53
7.1.240.0070.00715.90
7.1.230.0080.00515.84
7.1.220.0100.00715.54
7.1.210.0100.00615.76
7.1.200.0000.01415.95
7.1.190.0000.01315.73
7.1.180.0120.00015.55
7.1.170.0070.00715.82
7.1.160.0110.00415.88
7.1.150.0060.00615.80
7.1.140.0030.00615.97
7.1.130.0090.00315.66
7.1.120.0080.00816.00
7.1.110.0040.01215.52
7.1.100.0120.00315.98
7.1.90.0030.00915.93
7.1.80.0070.00715.89
7.1.70.0020.00716.48
7.1.60.0110.00917.78
7.1.50.0050.00716.49
7.1.40.0090.00616.06
7.1.30.0030.01215.62
7.1.20.0110.00415.55
7.1.10.0030.00915.57
7.1.00.0100.03719.10
7.0.330.0060.00615.35
7.0.320.0070.01015.38
7.0.310.0000.01515.21
7.0.300.0100.00315.45
7.0.290.0070.00315.32
7.0.280.0070.00315.48
7.0.270.0030.00615.40
7.0.260.0040.01115.36
7.0.250.0030.01015.59
7.0.240.0070.00315.31
7.0.230.0000.01215.50
7.0.220.0080.00615.29
7.0.210.0040.00415.53
7.0.200.0020.00716.33
7.0.190.0060.00615.58
7.0.180.0070.00715.44
7.0.170.0030.01115.39
7.0.160.0120.00315.29
7.0.150.0100.00315.49
7.0.140.0030.03718.65
7.0.130.0030.01315.43
7.0.120.0070.00315.61
7.0.110.0100.00615.42
7.0.100.0090.01215.59
7.0.90.0090.00615.58
7.0.80.0030.01215.36
7.0.70.0030.00915.70
7.0.60.0100.03817.70
7.0.50.0070.02516.75
7.0.40.0030.02816.82
7.0.30.0120.02716.74
7.0.20.0130.03416.98
7.0.10.0050.04716.78
7.0.00.0070.04516.86
5.6.400.0070.01114.38
5.6.390.0070.00414.05
5.6.380.0060.01214.56
5.6.370.0040.01414.67
5.6.360.0120.00014.70
5.6.350.0090.00614.35
5.6.340.0080.00614.78
5.6.330.0120.00014.33
5.6.320.0110.00414.70
5.6.310.0040.01114.63
5.6.300.0100.00714.71
5.6.290.0030.00914.77
5.6.280.0020.04317.53
5.6.270.0070.00414.68
5.6.260.0030.00614.64
5.6.250.0000.01414.38
5.6.240.0030.00714.65
5.6.230.0060.00814.46
5.6.220.0000.01414.23
5.6.210.0030.04617.55
5.6.200.0080.03216.24
5.6.190.0060.05117.40
5.6.180.1720.02717.48
5.6.170.0180.04517.35
5.6.160.0100.04217.53
5.6.150.0180.03116.23
5.6.140.0070.03516.21
5.6.130.0050.04316.21
5.6.120.0070.03717.67
5.6.110.0050.04417.89
5.6.100.0110.01717.86
5.6.90.0050.03517.77
5.6.80.0080.03217.44
5.6.70.2340.02317.43
5.6.60.0030.01014.29
5.6.50.0060.00314.13
5.6.40.0040.01414.00
5.6.30.0090.00914.34
5.6.20.0040.01114.30
5.6.10.0100.00714.58
5.6.00.0030.01014.15
5.5.380.0070.01414.19
5.5.370.0120.00414.42
5.5.360.0060.01014.11
5.5.350.0170.04317.24
5.5.340.0110.02316.25
5.5.330.0080.03217.29
5.5.320.0200.02317.43
5.5.310.0150.03817.46
5.5.300.0050.02816.25
5.5.290.0050.04316.35
5.5.280.0050.02617.82
5.5.270.0080.04117.72
5.5.260.0050.03217.50
5.5.250.0090.04017.50
5.5.240.0120.02317.19
5.5.230.0100.00714.38
5.5.220.0040.01114.44
5.5.210.0070.00714.06
5.5.200.0060.01014.17
5.5.190.0090.00914.16
5.5.180.0000.01214.01
5.5.170.0140.00014.35
5.5.160.0070.01014.34
5.5.150.0000.01914.22
5.5.140.0040.01514.25
5.5.130.0120.00614.18
5.5.120.0030.00914.14
5.5.110.0030.00914.41
5.5.100.0070.01114.38
5.5.90.0070.00714.26
5.5.80.0000.00914.38
5.5.70.0030.01013.88
5.5.60.0000.01514.11
5.5.50.0000.01714.18
5.5.40.0060.00614.42
5.5.30.0110.00314.18
5.5.20.0110.00313.91
5.5.10.0100.01014.40
5.5.00.0060.01514.05
5.4.450.0170.02721.22
5.4.440.0570.01920.75
5.4.430.0170.02120.75
5.4.420.0180.02520.75
5.4.410.0220.02220.75
5.4.400.0200.02820.75
5.4.390.0270.02320.34
5.4.380.0350.03315.18
5.4.370.0170.03915.04
5.4.360.0190.02815.21
5.4.350.0170.03615.11
5.4.340.0210.03015.19
5.4.330.0040.00711.58
5.4.320.0080.02812.04
5.4.310.0060.02212.04
5.4.300.0080.03112.04
5.4.290.0090.02912.04
5.4.280.0080.03211.99
5.4.270.0040.03511.99
5.4.260.0050.03011.99
5.4.250.0080.02611.99
5.4.240.0100.02311.99
5.4.230.0040.03011.99
5.4.220.0080.02611.99
5.4.210.0080.02811.99
5.4.200.0070.02211.99
5.4.190.0060.02611.99
5.4.180.0060.03511.99
5.4.170.0120.02711.99
5.4.160.0060.03011.99
5.4.150.0050.02711.98
5.4.140.0040.03011.83
5.4.130.0060.02611.82
5.4.120.0080.02611.80
5.4.110.0040.03011.80
5.4.100.0050.02811.80
5.4.90.0120.04111.80
5.4.80.0090.03311.80
5.4.70.0060.03011.80
5.4.60.0120.05411.80
5.4.50.0100.02411.80
5.4.40.0070.02611.79
5.4.30.0080.02311.79
5.4.20.0090.02711.79
5.4.10.0070.02811.79
5.4.00.0030.03011.53
5.3.290.0030.02412.19
5.3.280.0040.02912.14
5.3.270.0080.02812.15
5.3.260.0040.03212.15
5.3.250.0080.02712.15
5.3.240.0030.02612.15
5.3.230.0050.02612.15
5.3.220.0050.03012.13
5.3.210.0100.02712.13
5.3.200.0080.02912.13
5.3.190.0080.02912.13
5.3.180.0040.03412.13
5.3.170.0090.02712.13
5.3.160.0120.04312.13
5.3.150.0090.03812.13
5.3.140.0080.02812.12
5.3.130.0070.03012.12
5.3.120.0100.03412.12
5.3.110.0080.03112.12
5.3.100.0070.03011.86
5.3.90.0060.03311.85
5.3.80.0080.02711.85
5.3.70.0050.03511.84
5.3.60.0060.03311.83
5.3.50.0080.03011.81
5.3.40.0090.03411.81
5.3.30.0100.03111.79
5.3.20.0090.02611.68
5.3.10.0050.02211.66
5.3.00.0050.02411.65
5.2.170.0080.0319.24
5.2.160.0060.0319.23
5.2.150.0030.0349.23
5.2.140.0060.0319.23
5.2.130.0030.0339.18
5.2.120.0040.0319.19
5.2.110.0040.0339.19
5.2.100.0090.0359.18
5.2.90.0060.0379.18
5.2.80.0070.0339.18
5.2.70.0060.0359.18
5.2.60.0140.0339.14
5.2.50.0090.0399.11
5.2.40.0060.0399.09
5.2.30.0090.0389.06
5.2.20.0090.0359.05
5.2.10.0110.0338.95
5.2.00.0090.0378.82
5.1.60.0050.0348.10
5.1.50.0030.0318.09
5.1.40.0050.0288.07
5.1.30.0040.0348.42
5.1.20.0070.0278.45
5.1.10.0060.0288.17
5.1.00.0040.0298.17
5.0.50.0070.0216.65
5.0.40.0050.0226.51
5.0.30.0040.0346.32
5.0.20.0030.0226.29
5.0.10.0040.0226.27
5.0.00.0040.0326.26
4.4.90.0060.0154.78
4.4.80.0010.0204.75
4.4.70.0040.0174.75
4.4.60.0040.0164.75
4.4.50.0050.0174.77
4.4.40.0050.0244.71
4.4.30.0050.0164.76
4.4.20.0050.0184.84
4.4.10.0020.0184.84
4.4.00.0060.0264.76
4.3.110.0040.0154.67
4.3.100.0030.0204.67
4.3.90.0060.0154.63
4.3.80.0040.0274.58
4.3.70.0020.0194.63
4.3.60.0030.0164.63
4.3.50.0030.0164.63
4.3.40.0020.0284.54
4.3.30.0020.0263.31
4.3.20.0030.0193.29
4.3.10.0040.0163.25
4.3.00.0100.01728.29

preferences:
38.98 ms | 401 KiB | 5 Q