3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo generateKey(); function generateKey() { return base64encode(randBuffer(48)); } function base64encode($buf) { $enc = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; return $enc; } function randBuffer($n) { try { $buf = openssl_random_pseudo_bytes($n); } catch (Exception $e) { $buf = ""; for ($i = 0; $i < $n; $i++) { $buf .= ord(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.1.70.0040.00417.19
7.1.60.0100.00719.70
7.1.50.0100.00316.99
7.1.00.0100.07022.54
7.0.200.0000.00716.59
7.0.140.0100.06022.18
7.0.60.0070.08019.89
7.0.50.0070.08017.91
7.0.40.0130.07720.09
7.0.30.0200.04020.19
7.0.20.0200.08020.27
7.0.10.0100.04320.25
7.0.00.0200.07320.24
5.6.280.0030.07321.13
5.6.210.0130.08020.63
5.6.200.0130.04018.25
5.6.190.0130.08720.47
5.6.180.4030.03720.43
5.6.170.0270.03720.61
5.6.160.0070.06720.43
5.6.150.0030.04318.25
5.6.140.0100.04018.21
5.6.130.0000.06718.18
5.6.120.0030.09021.10
5.6.110.0000.07021.07
5.6.100.0130.08021.00
5.6.90.0100.04020.98
5.6.80.0030.04020.55
5.6.70.3130.03020.42
5.5.350.0300.07320.50
5.5.340.0070.04718.02
5.5.330.0070.05320.63
5.5.320.3930.04020.29
5.5.310.0270.05320.43
5.5.300.0070.08317.98
5.5.290.0100.07718.14
5.5.280.0000.08020.81
5.5.270.0100.06020.80
5.5.260.0030.08720.77
5.5.250.0070.07320.71
5.5.240.0170.06320.27
5.4.450.0330.05329.93
5.4.440.0300.05029.93
5.4.430.0370.03329.93
5.4.420.0470.05029.93
5.4.410.0270.04029.92
5.4.400.0370.04029.48
5.4.390.0130.05028.79
5.4.380.0030.06318.59
5.4.370.0170.06718.62
5.4.360.0330.03018.56
5.4.350.0200.05018.56
5.4.340.0170.05718.55
5.4.320.0080.04712.50
5.4.310.0070.03712.50
5.4.300.0090.03512.51
5.4.290.0040.04612.50
5.4.280.0050.03812.40
5.4.270.0100.03612.39
5.4.260.0040.04512.40
5.4.250.0060.03912.40
5.4.240.0080.03612.39
5.4.230.0130.03212.39
5.4.220.0060.03512.39
5.4.210.0050.03612.39
5.4.200.0080.03712.39
5.4.190.0060.04012.38
5.4.180.0070.03512.39
5.4.170.0060.03912.39
5.4.160.0020.04112.39
5.4.150.0050.03712.39
5.4.140.0060.03912.07
5.4.130.0040.03812.06
5.4.120.0040.03812.02
5.4.110.0090.03312.01
5.4.100.0060.03512.01
5.4.90.0070.03512.01
5.4.80.0060.03712.01
5.4.70.0060.03512.01
5.4.60.0060.03512.01
5.4.50.0070.03412.01
5.4.40.0060.03512.00
5.4.30.0040.03711.99
5.4.20.0070.03312.00
5.4.10.0070.03311.99
5.4.00.0040.03711.48
5.3.290.0070.03912.80
5.3.280.0080.03612.70
5.3.270.0040.04112.73
5.3.260.0050.04112.72
5.3.250.0080.03612.72
5.3.240.0070.03812.72
5.3.230.0050.03912.71
5.3.220.0070.03612.68
5.3.210.0080.03812.68
5.3.200.0050.03812.68
5.3.190.0100.03512.68
5.3.180.0090.03612.67
5.3.170.0090.03612.67
5.3.160.0080.03612.67
5.3.150.0100.04912.68
5.3.140.0060.05212.66
5.3.130.0060.05512.66
5.3.120.0090.05212.66
5.3.110.0070.04912.66
5.3.100.0080.03512.13
5.3.90.0060.03712.11
5.3.80.0020.04112.10
5.3.70.0090.03512.10
5.3.60.0110.03212.08
5.3.50.0080.03512.03
5.3.40.0100.03612.03
5.3.30.0050.03712.00
5.3.20.0040.03711.77
5.3.10.0050.03511.74
5.3.00.0080.03511.72
5.2.170.0040.0319.23
5.2.160.0040.0309.23
5.2.150.0040.0319.23
5.2.140.0040.0319.23
5.2.130.0020.0329.19
5.2.120.0060.0289.19
5.2.110.0110.0319.19
5.2.100.0080.0369.18
5.2.90.0040.0329.18
5.2.80.0020.0339.18
5.2.70.0040.0319.18
5.2.60.0040.0319.14
5.2.50.0050.0319.11
5.2.40.0100.0309.08
5.2.30.0050.0319.06
5.2.20.0060.0289.05
5.2.10.0050.0288.96
5.2.00.0040.0298.82
5.1.60.0030.0258.10
5.1.50.0050.0268.09
5.1.40.0090.0288.07
5.1.30.0030.0318.43
5.1.20.0050.0308.45
5.1.10.0050.0278.17
5.1.00.0050.0318.17
5.0.50.0030.0246.64
5.0.40.0050.0206.51
5.0.30.0050.0296.32
5.0.20.0060.0196.29
5.0.10.0020.0226.27
5.0.00.0040.0326.26
4.4.90.0060.0164.78
4.4.80.0040.0204.76
4.4.70.0030.0164.76
4.4.60.0030.0164.75
4.4.50.0030.0164.77
4.4.40.0030.0274.71
4.4.30.0050.0174.76
4.4.20.0030.0174.84
4.4.10.0030.0174.85
4.4.00.0050.0284.76
4.3.110.0040.0174.66
4.3.100.0040.0144.67
4.3.90.0050.0124.63
4.3.80.0050.0224.59
4.3.70.0030.0204.63
4.3.60.0020.0214.63
4.3.50.0030.0214.63
4.3.40.0040.0294.54
4.3.30.0020.0223.30
4.3.20.0020.0213.28
4.3.10.0000.0233.25
4.3.00.0070.01328.29

preferences:
32.65 ms | 400 KiB | 5 Q