3v4l.org

run code in 300+ PHP versions simultaneously
<?php mt_srand(42); for ($i = 0; $i < 20; $i++) { echo generate_key() . "\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) { // return openssl_random_pseudo_bytes($n); // fatal error on some versions of php $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.3.10.0150.00416.32
7.3.00.0180.00016.23
7.2.130.0040.01116.89
7.2.120.0110.00416.65
7.2.110.0090.00616.67
7.2.100.0100.00716.55
7.2.90.0040.01216.40
7.2.80.0090.00616.71
7.2.70.0140.00916.89
7.2.60.0170.00316.51
7.2.50.0110.00716.67
7.2.40.0120.00616.71
7.2.30.0000.01816.85
7.2.20.0100.00716.49
7.2.10.0090.00916.82
7.2.00.0110.00418.12
7.1.250.0030.01515.71
7.1.240.0090.00915.44
7.1.230.0100.00715.80
7.1.220.0040.01115.67
7.1.210.0190.00515.49
7.1.200.0150.00015.70
7.1.190.0170.01415.80
7.1.180.0100.00615.27
7.1.170.0060.00915.50
7.1.160.0090.00915.36
7.1.150.0100.00915.61
7.1.140.0120.00315.52
7.1.130.0110.01516.00
7.1.120.0060.01015.70
7.1.110.0070.00715.54
7.1.100.0100.00615.61
7.1.90.0090.00615.81
7.1.80.0060.00615.63
7.1.70.0060.00716.53
7.1.60.0150.00317.56
7.1.50.0080.00716.23
7.1.40.0040.00915.77
7.1.30.0100.01015.50
7.1.20.0030.01015.43
7.1.10.0030.01215.61
7.1.00.0060.04319.06
7.0.330.0070.00715.09
7.0.320.0060.00915.15
7.0.310.0100.00715.24
7.0.300.0070.00715.34
7.0.290.0110.00715.11
7.0.280.0120.00915.36
7.0.270.0170.00315.08
7.0.260.0060.01015.15
7.0.250.0100.00715.39
7.0.240.0120.00014.98
7.0.230.0030.01214.93
7.0.220.0050.00814.89
7.0.210.0120.00315.12
7.0.200.0070.00616.03
7.0.190.0100.00715.03
7.0.180.0100.01015.25
7.0.170.0070.01014.91
7.0.160.0070.01015.20
7.0.150.0130.00315.05
7.0.140.0110.03518.69
7.0.130.0060.01315.13
7.0.120.0100.00715.01
7.0.110.0070.00415.14
7.0.100.0130.00015.44
7.0.90.0100.00715.30
7.0.80.0030.01314.89
7.0.70.0030.01315.27
7.0.60.0090.04417.74
7.0.50.0110.04316.64
7.0.40.0060.03016.61
7.0.30.0290.03416.79
7.0.20.0140.03516.82
7.0.10.0050.03116.78
7.0.00.0080.04516.68
5.6.380.0090.00614.10
5.6.370.0160.00814.01
5.6.360.0150.00914.25
5.6.350.0080.01714.70
5.6.340.0070.01314.40
5.6.330.0050.01414.52
5.6.320.0160.00314.06
5.6.310.0070.00414.01
5.6.300.0000.01314.15
5.6.290.0070.01414.55
5.6.280.0100.04117.72
5.6.270.0090.01514.14
5.6.260.0100.01014.46
5.6.250.0160.00914.37
5.6.240.0080.01614.29
5.6.230.0080.01314.24
5.6.220.0040.01514.33
5.6.210.0130.04117.61
5.6.200.0080.03416.32
5.6.190.0060.02917.42
5.6.180.1380.02517.32
5.6.170.0100.03217.35
5.6.160.0100.04617.32
5.6.150.0110.03816.25
5.6.140.0040.03116.35
5.6.130.0090.02716.21
5.6.120.0140.04217.50
5.6.110.0150.03717.37
5.6.100.0080.04417.46
5.6.90.0110.02817.66
5.6.80.0090.04417.30
5.6.70.2180.02117.27
5.6.60.0080.01114.42
5.6.50.0030.01514.22
5.6.40.0070.01014.00
5.6.30.0110.00413.73
5.6.20.0120.00814.18
5.6.10.0060.00614.09
5.6.00.0120.00914.28
5.5.380.0100.00611.20
5.5.370.0100.01011.22
5.5.360.0060.00611.37
5.5.350.0150.04315.74
5.5.340.0100.04314.59
5.5.330.0110.02215.78
5.5.320.0200.04015.80
5.5.310.0190.04015.60
5.5.300.0100.04614.59
5.5.290.0120.03914.83
5.5.280.0060.04416.08
5.5.270.0070.02415.97
5.5.260.0100.04415.98
5.5.250.0050.04115.73
5.5.240.0140.04115.64
5.5.230.0030.01410.99
5.5.220.0070.01010.61
5.5.210.0060.00910.89
5.5.200.0080.00310.52
5.5.190.0050.00810.95
5.5.180.0000.01510.81
5.5.170.0060.00610.67
5.5.160.0050.00510.51
5.5.150.0070.00411.02
5.5.140.0040.01110.79
5.5.130.0000.01210.96
5.5.120.0040.00810.45
5.5.110.0100.00310.73
5.5.100.0140.00010.50
5.5.90.0040.01111.01
5.5.80.0080.00810.65
5.5.70.0090.00611.09
5.5.60.0060.00610.73
5.5.50.0040.00810.84
5.5.40.0060.00610.79
5.5.30.0040.01111.16
5.5.20.0040.00710.58
5.5.10.0070.00710.82
5.5.00.0000.00910.71
5.4.450.0140.02820.42
5.4.440.0190.02220.31
5.4.430.0210.02120.48
5.4.420.0230.02520.44
5.4.410.0150.02720.36
5.4.400.0230.02520.28
5.4.390.0140.02819.97
5.4.380.0100.03114.88
5.4.370.0100.03214.77
5.4.360.0070.03114.60
5.4.350.0110.02814.72
5.4.340.0040.03914.76
5.4.330.0120.00011.16
5.4.320.0070.02511.94
5.4.310.0070.02411.79
5.4.300.0080.02311.70
5.4.290.0090.02211.66
5.4.280.0060.02911.80
5.4.270.0110.03211.77
5.4.260.0060.03411.49
5.4.250.0060.02711.54
5.4.240.0050.02211.66
5.4.230.0050.02411.68
5.4.220.0080.02711.81
5.4.210.0100.02411.70
5.4.200.0070.02311.78
5.4.190.0070.01911.60
5.4.180.0040.02211.75
5.4.170.0070.02811.50
5.4.160.0040.02611.53
5.4.150.0080.02211.61
5.4.140.0070.02511.55
5.4.130.0040.02511.59
5.4.120.0060.03111.54
5.4.110.0080.02511.45
5.4.100.0110.01911.56
5.4.90.0060.02411.30
5.4.80.0070.02311.42
5.4.70.0090.02411.47
5.4.60.0070.02511.45
5.4.50.0060.02611.34
5.4.40.0080.02111.46
5.4.30.0070.02611.48
5.4.20.0070.02611.49
5.4.10.0060.02211.47
5.4.00.0060.02611.17
5.3.290.0060.02611.65
5.3.280.0050.02311.68
5.3.270.0040.02611.70
5.3.260.0070.02411.67
5.3.250.0050.02511.72
5.3.240.0050.02411.51
5.3.230.0080.02311.55
5.3.220.0070.02211.58
5.3.210.0090.01811.56
5.3.200.0050.02111.65
5.3.190.0040.02411.63
5.3.180.0070.02111.62
5.3.170.0050.02511.57
5.3.160.0040.02511.69
5.3.150.0080.02111.64
5.3.140.0050.02411.58
5.3.130.0050.02311.63
5.3.120.0070.02311.51
5.3.110.0070.02411.51
5.3.100.0090.02011.35
5.3.90.0020.02411.28
5.3.80.0080.02011.27
5.3.70.0060.02111.21
5.3.60.0060.02311.33
5.3.50.0040.02511.20
5.3.40.0070.02011.29
5.3.30.0060.02111.32
5.3.20.0040.02411.17
5.3.10.0080.01910.93
5.3.00.0040.02311.07
5.2.170.0070.0189.46
5.2.160.0040.0209.46
5.2.150.0050.0199.44
5.2.140.0060.0229.47
5.2.130.0040.0209.32
5.2.120.0030.0229.32
5.2.110.0070.0189.38
5.2.100.0020.0219.29
5.2.90.0050.0189.33
5.2.80.0080.0189.37
5.2.70.0040.0219.31
5.2.60.0020.0229.24
5.2.50.0040.0209.16
5.2.40.0060.0179.20
5.2.30.0030.0189.24
5.2.20.0060.0179.18
5.2.10.0030.0189.06
5.2.00.0040.0189.03
5.1.60.0010.0188.31
5.1.50.0060.0198.31
5.1.40.0080.0158.40
5.1.30.0070.0148.58
5.1.20.0060.0198.42
5.1.10.0030.0188.48
5.1.00.0060.0148.33
5.0.50.0030.0167.39
5.0.40.0040.0137.32
5.0.30.0040.0177.23
5.0.20.0040.0137.21
5.0.10.0040.0177.20
5.0.00.0020.0197.20
4.4.90.0010.0166.46
4.4.80.0030.0146.45
4.4.70.0020.0136.45
4.4.60.0050.0126.45
4.4.50.0020.0156.45
4.4.40.0010.0196.43
4.4.30.0030.0106.45
4.4.20.0040.0146.49
4.4.10.0040.0106.50
4.4.00.0030.0156.45
4.3.110.0020.0106.40
4.3.100.0020.0136.40
4.3.90.0020.0146.39
4.3.80.0010.0166.36
4.3.70.0050.0116.39
4.3.60.0020.0106.38
4.3.50.0030.0116.38
4.3.40.0020.0166.34
4.3.30.0020.0115.73
4.3.20.0030.0135.71
4.3.10.0040.0145.69
4.3.00.0080.01218.21

preferences:
40.63 ms | 400 KiB | 5 Q