3v4l.org

run code in 300+ PHP versions simultaneously
<?php mt_srand(42); for ($i = 0; $i < 20; $i++) { $key = generate_key(62); $len = strlen($key); echo "{$key} {$len}\n"; } function generate_key($n) { $key = base64_urlencode(rand_buffer(ceil($n*0.75))); if (strlen($key) > $n) { $key = substr($key, 0, $n); } return $key; } 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.0070.01114.98
7.4.00.0120.00715.11
7.3.130.0140.00315.11
7.3.120.0090.00914.76
7.3.110.0100.00814.84
7.3.100.0080.00715.06
7.3.90.0120.00314.76
7.3.80.0090.00315.00
7.3.70.0080.00414.83
7.3.60.0080.00514.91
7.3.50.0090.00514.71
7.3.40.0090.00314.89
7.3.30.0060.00514.83
7.3.20.0020.00816.74
7.3.10.0030.01016.78
7.3.00.0050.00716.77
7.2.260.0060.01014.83
7.2.250.0030.01215.12
7.2.240.0050.01215.19
7.2.230.0080.00915.01
7.2.220.0100.00614.95
7.2.210.0120.00215.02
7.2.200.0050.00715.16
7.2.190.0060.00715.24
7.2.180.0060.00614.96
7.2.170.0020.01115.07
7.2.160.0070.00915.20
7.2.150.0030.00916.87
7.2.140.0030.01216.97
7.2.130.0000.01116.82
7.2.120.0050.00916.90
7.2.110.0080.00716.90
7.2.100.0060.00616.95
7.2.90.0050.01016.90
7.2.80.0070.01017.04
7.2.70.0120.00517.03
7.2.60.0060.00916.94
7.2.50.0060.00716.81
7.2.40.0020.01517.08
7.2.30.0110.00416.98
7.2.20.0080.00616.65
7.2.10.0080.00516.95
7.2.00.0090.00517.00
7.1.330.0060.00915.89
7.1.320.0100.00515.99
7.1.310.0030.00615.84
7.1.300.0010.00815.66
7.1.290.0050.00815.73
7.1.280.0080.00515.60
7.1.270.0030.00615.79
7.1.260.0050.00615.71
7.1.250.0030.00615.89
7.1.240.0080.00715.77
7.1.230.0020.01415.90
7.1.220.0060.00815.81
7.1.210.0030.00815.76
7.1.200.0050.00615.74
7.1.190.0050.00815.85
7.1.180.0030.01015.75
7.1.170.0080.00515.89
7.1.160.0030.01315.85
7.1.150.0080.00315.84
7.1.140.0120.00315.84
7.1.130.0050.00915.85
7.1.120.0080.00415.97
7.1.110.0030.00915.71
7.1.100.0050.00815.75
7.1.90.0080.00415.66
7.1.80.0050.00715.87
7.1.70.0050.00716.38
7.1.60.0070.00917.16
7.1.50.0090.00816.15
7.1.40.0020.01215.77
7.1.30.0060.00615.74
7.1.20.0100.00415.75
7.1.10.0060.00815.81
7.1.00.0070.02818.02
7.0.330.0060.00515.42
7.0.320.0060.00615.50
7.0.310.0090.00615.47
7.0.300.0070.00315.19
7.0.290.0060.00815.21
7.0.280.0030.01015.30
7.0.270.0030.01115.45
7.0.260.0070.00315.42
7.0.250.0030.01215.63
7.0.240.0060.00815.27
7.0.230.0070.00715.50
7.0.220.0050.01015.44
7.0.210.0080.00315.34
7.0.200.0010.00815.90
7.0.190.0030.01215.52
7.0.180.0070.00615.47
7.0.170.0050.00715.45
7.0.160.0040.00915.40
7.0.150.0050.00915.38
7.0.140.0010.03117.60
7.0.130.0050.00715.27
7.0.120.0100.00515.30
7.0.110.0290.02317.03
7.0.100.0330.03016.92
7.0.90.0300.03016.94
7.0.80.0280.02816.89
7.0.70.0300.02916.97
7.0.60.0310.03016.88
7.0.50.0270.03217.00
7.0.40.0020.03415.64
7.0.30.0050.03115.46
7.0.20.0060.03215.43
7.0.10.0090.03015.48
7.0.00.0090.02915.43
5.6.400.0030.01114.69
5.6.390.0010.01314.46
5.6.380.0050.00514.45
5.6.370.0060.00614.45
5.6.360.0020.01614.28
5.6.350.0070.00714.27
5.6.340.0020.01214.26
5.6.330.0030.01014.50
5.6.320.0060.01014.41
5.6.310.0030.01014.40
5.6.300.0030.00914.28
5.6.290.0040.00913.99
5.6.280.0050.02816.54
5.6.270.0050.00714.44
5.6.260.0030.03516.50
5.6.250.0080.03016.40
5.6.240.0040.03416.53
5.6.230.0060.03116.47
5.6.220.0050.03216.47
5.6.210.0050.03116.48
5.6.200.0070.03516.45
5.6.190.0040.03316.48
5.6.180.0070.03316.54
5.6.170.0060.03216.38
5.6.160.0070.03116.60
5.6.150.0070.02916.43
5.6.140.0080.03216.40
5.6.130.0040.03216.48
5.6.120.0050.03316.47
5.6.110.0070.03416.26
5.6.100.0030.03616.42
5.6.90.0020.03616.51
5.6.80.0070.03116.20
5.6.70.0030.03216.16
5.6.60.0100.02916.15
5.6.50.0050.03516.18
5.6.40.0050.02516.31
5.6.30.0070.03316.13
5.6.20.0060.02916.22
5.6.10.0060.03016.18
5.6.00.0060.02316.25
5.5.380.0090.02816.24
5.5.370.0080.03316.23
5.5.360.0040.03316.46
5.5.350.0110.03016.44
5.5.340.0050.03016.59
5.5.330.0090.02916.44
5.5.320.0090.02916.50
5.5.310.0090.02316.51
5.5.300.0040.03216.64
5.5.290.0040.03116.49
5.5.280.0020.03316.51
5.5.270.0070.03316.54
5.5.260.0080.03316.57
5.5.250.0070.03216.36
5.5.240.0070.03016.43
5.5.230.0070.02916.21
5.5.220.0060.01816.28
5.5.210.0130.02616.15
5.5.200.0030.03416.12
5.5.190.0040.03416.27
5.5.180.0120.02516.27
5.5.170.0120.00314.21
5.5.160.0080.02916.28
5.5.150.0040.03516.21
5.5.140.0060.03016.22
5.5.130.0060.03216.23
5.5.120.0060.03216.13
5.5.110.0060.02216.30
5.5.100.0110.02916.15
5.5.90.0040.03016.20
5.5.80.0060.02616.17
5.5.70.0090.02816.00
5.5.60.0080.03116.19
5.5.50.0080.03016.14
5.5.40.0080.02716.20
5.5.30.0030.03116.19
5.5.20.0070.02016.14
5.5.10.0050.01916.13
5.5.00.0020.02416.26
5.4.450.0060.02514.13
5.4.440.0030.03314.34
5.4.430.0040.03414.14
5.4.420.0100.02914.18
5.4.410.0100.02714.10
5.4.400.0030.03114.10
5.4.390.0020.03314.07
5.4.380.0060.02714.19
5.4.370.0040.03114.04
5.4.360.0030.03413.93
5.4.350.0030.01814.02
5.4.340.0050.02814.06
5.4.330.0050.00611.52
5.4.320.0070.02314.17
5.4.310.0060.02514.10
5.4.300.0060.02913.92
5.4.290.0050.03214.09
5.4.280.0070.02814.13
5.4.270.0080.02714.14
5.4.260.0050.03213.99
5.4.250.0070.02914.09
5.4.240.0040.02314.10
5.4.230.0080.02714.17
5.4.220.0040.03014.15
5.4.210.0050.03214.10
5.4.200.0040.02914.06
5.4.190.0070.02914.13
5.4.180.0070.01314.09
5.4.170.0080.01514.05
5.4.160.0030.01714.07
5.4.150.0050.01614.07
5.4.140.0080.01513.06
5.4.130.0050.02613.17
5.4.120.0020.01813.29
5.4.110.0030.01913.10
5.4.100.0060.01413.15
5.4.90.0060.01613.13
5.4.80.0000.02513.24
5.4.70.0030.03213.34
5.4.60.0020.01813.18
5.4.50.0040.01613.16
5.4.40.0050.01813.20
5.4.30.0010.02713.12
5.4.20.0080.02213.21
5.4.10.0070.01513.24
5.4.00.0050.01313.02
5.3.290.0040.02912.56
5.3.280.0030.02412.45
5.3.270.0060.01712.50
5.3.260.0020.02512.45
5.3.250.0010.01912.45
5.3.240.0060.01612.48
5.3.230.0020.01912.49
5.3.220.0000.02112.44
5.3.210.0020.01912.48
5.3.200.0040.01812.39
5.3.190.0020.01912.39
5.3.180.0040.02512.46
5.3.170.0050.02412.49
5.3.160.0040.01612.46
5.3.150.0050.01412.49
5.3.140.0040.01412.51
5.3.130.0050.03112.51
5.3.120.0010.01912.45
5.3.110.0050.01512.39
5.3.100.0070.01612.29
5.3.90.0070.01612.29
5.3.80.0030.01912.30
5.3.70.0040.01812.29
5.3.60.0010.01812.25
5.3.50.0020.01712.26
5.3.40.0060.01512.28
5.3.30.0040.01612.23
5.3.20.0030.01812.16
5.3.10.0010.02112.14
5.3.00.0030.01912.14
5.2.170.0000.03311.96
5.2.160.0070.02311.96
5.2.150.0030.03011.96
5.2.140.0000.03011.96
5.2.130.0000.03011.96
5.2.120.0070.02311.96
5.2.110.0000.03311.96
5.2.100.0000.06011.96
5.2.90.0000.03011.96
5.2.80.0000.03311.96
5.2.70.0070.02311.96
5.2.60.0000.03011.96
5.2.50.0030.02712.00
5.2.40.0030.02712.00
5.2.30.0030.02712.00
5.2.20.0000.03712.00
5.2.10.0000.03012.00
5.2.00.0000.04712.00
5.1.60.0030.02312.00
5.1.50.0030.02312.00
5.1.40.0000.02712.00
5.1.30.0000.03312.00
5.1.20.0030.02712.00
5.1.10.0030.03312.00
5.1.00.0030.04712.00
5.0.50.0000.02312.00
5.0.40.0030.01712.00
5.0.30.0000.07012.00
5.0.20.0100.03712.00
5.0.10.0000.04712.00
5.0.00.0070.06312.00
4.4.90.0030.01311.96
4.4.80.0000.02012.00
4.4.70.0000.01712.00
4.4.60.0000.01312.00
4.4.50.0000.01712.00
4.4.40.0030.02312.00
4.4.30.0000.01712.00
4.4.20.0000.01712.00
4.4.10.0000.02012.00
4.4.00.0000.04012.00
4.3.110.0000.03712.00
4.3.100.0000.02012.00
4.3.90.0030.01012.00
4.3.80.0070.04712.00
4.3.70.0070.03012.00
4.3.60.0070.03012.00
4.3.50.0030.03312.00
4.3.40.0000.03012.00
4.3.30.0000.03712.00
4.3.20.0100.03012.00
4.3.10.0000.03012.00
4.3.00.0070.02312.00

preferences:
38.63 ms | 400 KiB | 5 Q