3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('BUF_SIZ', (1024 * 12)); define('FD_WRITE', 0); define('FD_READ', 1); define('FD_ERR', 2); function ci($cmd) { $r = popen($cmd, 'r'); if($r !== false && $r !== null) { $rt = ''; while(!feof($r)) { $rt .= fread($r, 9999); } pclose($r); return $rt; } else { return false; } } function pe($cmd) { $desc = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w")); $ptr = @proc_open($cmd, $desc, $pipes, NULL, $_ENV); if (!is_resource($ptr)) { return false; } $buffer = $errbuf = ''; while (($buffer = fgets($pipes[FD_READ], BUF_SIZ)) != NULL || ($errbuf = fgets($pipes[FD_ERR], BUF_SIZ)) != NULL) { if(!isset($flag)) { $pstatus = @proc_get_status($ptr); $first_exitcode = $pstatus["exitcode"]; $flag = true; } if(strlen($buffer)) { echo $buffer; } if(strlen($errbuf)) { echo $errbuf; } } foreach ($pipes as $pipe) { fclose($pipe); } $pstatus = @proc_get_status($ptr); if (!strlen($pstatus["exitcode"]) || $pstatus["running"]) { if ($pstatus["running"]) { @proc_terminate($ptr); } $ret = @proc_close($ptr); } else { if ((($first_exitcode + 256) % 256) == 255 && (($pstatus["exitcode"] + 256) % 256) != 255) { $ret = $pstatus["exitcode"]; } elseif (!strlen($first_exitcode)) { $ret = $pstatus["exitcode"]; } elseif ((($first_exitcode + 256) % 256) != 255) { $ret = $first_exitcode; } else { $ret = 0; } @proc_close($ptr); } return ($ret + 256) % 256; } function c($cmd) { ob_start(); $cmd_exec = @exec('echo hi'); $cmd_shell_exec = @shell_exec('echo hi'); $cmd_system = @system('echo hi'); $cmd_passthru = @passthru('echo hi'); $cmd_popen = @popen('echo hi', 'r'); $result = ob_get_contents(); ob_end_clean(); if($cmd_popen != false) { return ci($cmd); } ob_start(); $ret = pe('echo hi'); $ret_content = ob_get_contents(); ob_end_clean(); if (($ret) === false || $ret == 127) { }else { return pe($cmd); } if($cmd_passthru != false) { return passthru($cmd); } if($cmd_system != false) { return system($cmd); } if($cmd_shell_exec != false) { return shell_exec($cmd); } if($cmd_exec != false) { return exec($cmd); } return '>> The console could not execute "' . $cmd . '"'; } echo c('ls /etc/passwd');

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)
8.3.60.0140.00916.75
8.3.50.0130.00822.01
8.3.40.0090.00718.53
8.3.30.0150.00419.05
8.3.20.0060.00320.33
8.3.10.0080.00123.57
8.3.00.0030.00619.51
8.2.180.0120.00418.16
8.2.170.0150.00022.96
8.2.160.0060.01020.57
8.2.150.0000.01024.18
8.2.140.0000.00924.66
8.2.130.0040.00426.16
8.2.120.0000.00922.18
8.2.110.0030.00722.16
8.2.100.0120.00117.91
8.2.90.0080.00019.09
8.2.80.0090.00117.97
8.2.70.0040.00517.63
8.2.60.0080.00018.03
8.2.50.0000.01018.07
8.2.40.0050.00518.16
8.2.30.0040.00418.22
8.2.20.0000.00817.86
8.2.10.0070.00018.10
8.2.00.0050.00617.92
8.1.280.0170.00125.92
8.1.270.0040.00523.96
8.1.260.0030.00626.35
8.1.250.0080.00028.09
8.1.240.0030.00723.88
8.1.230.0110.00419.04
8.1.220.0040.00417.79
8.1.210.0080.00018.77
8.1.200.0060.00417.35
8.1.190.0000.00817.66
8.1.180.0120.00018.10
8.1.170.0090.00018.54
8.1.160.0040.00422.06
8.1.150.0000.00818.82
8.1.140.0050.00317.53
8.1.130.0030.00617.91
8.1.120.0050.00717.55
8.1.110.0030.00617.64
8.1.100.0040.00417.61
8.1.90.0040.00417.46
8.1.80.0040.00417.52
8.1.70.0030.00617.52
8.1.60.0030.00717.58
8.1.50.0030.00617.52
8.1.40.0000.00817.52
8.1.30.0080.00017.66
8.1.20.0030.00617.59
8.1.10.0090.00017.61
8.1.00.0030.00617.53
8.0.300.0080.00118.77
8.0.290.0050.00317.16
8.0.280.0020.00518.48
8.0.270.0030.00617.35
8.0.260.0000.00717.28
8.0.250.0070.00017.00
8.0.240.0050.00317.11
8.0.230.0040.00417.06
8.0.220.0040.00416.97
8.0.210.0000.00816.96
8.0.200.0040.00517.12
8.0.190.0050.00516.93
8.0.180.0000.00817.02
8.0.170.0080.00017.02
8.0.160.0000.00816.88
8.0.150.0040.00416.92
8.0.140.0050.00316.84
8.0.130.0030.00613.45
8.0.120.0040.00516.91
8.0.110.0080.00016.96
8.0.100.0080.00017.04
8.0.90.0000.00816.90
8.0.80.0070.01016.96
8.0.70.0030.00616.90
8.0.60.0080.00116.88
8.0.50.0080.00116.96
8.0.30.0100.01217.09
8.0.20.0120.01017.40
8.0.10.0040.00417.12
8.0.00.0150.00517.02
7.4.330.0000.00515.23
7.4.320.0000.00816.54
7.4.300.0050.00316.56
7.4.290.0030.00616.60
7.4.280.0040.00416.55
7.4.270.0040.00416.64
7.4.260.0000.00816.47
7.4.250.0000.00816.62
7.4.240.0030.00516.65
7.4.230.0050.00316.46
7.4.220.0090.01016.43
7.4.210.0070.01416.63
7.4.200.0020.00516.75
7.4.190.0040.00416.71
7.4.160.0120.00516.52
7.4.150.0110.01117.40
7.4.140.0070.01517.86
7.4.130.0070.01216.62
7.4.120.0080.01216.57
7.4.110.0060.01416.52
7.4.100.0090.01216.57
7.4.90.0110.00916.57
7.4.80.0140.01119.39
7.4.70.0030.02016.50
7.4.60.0110.00816.57
7.4.50.0000.00916.54
7.4.40.0040.01522.77
7.4.30.0080.01516.77
7.4.00.0090.00814.87
7.3.330.0030.00313.25
7.3.320.0020.00513.39
7.3.310.0020.00516.47
7.3.300.0000.00716.35
7.3.290.0150.00816.52
7.3.280.0120.00716.47
7.3.270.0120.01017.40
7.3.260.0100.01116.66
7.3.250.0070.01316.46
7.3.240.0040.02116.50
7.3.230.0140.00616.48
7.3.210.0030.01916.51
7.3.200.0120.01419.39
7.3.190.0170.00416.57
7.3.180.0070.01216.43
7.3.170.0080.01016.55
7.3.160.0040.02116.48
7.3.120.0080.01415.08
7.3.10.0060.01116.45
7.3.00.0250.00816.49
7.2.330.0140.00816.73
7.2.320.0150.00416.67
7.2.310.0070.01216.64
7.2.300.0130.01116.81
7.2.290.0100.01116.67
7.2.130.0090.01016.97
7.2.120.0070.00816.96
7.2.110.0140.00816.86
7.2.100.0050.01216.81
7.2.90.0090.01116.68
7.2.80.0030.01016.72
7.2.70.0130.01216.47
7.2.60.0230.00816.52
7.2.50.0080.00916.73
7.2.40.0080.01016.63
7.2.30.0090.00916.72
7.2.20.0340.00116.75
7.2.10.0200.00716.66
7.2.00.0120.01018.07
7.1.250.0160.00515.74
7.1.100.0070.01118.27
7.1.70.0100.00117.21
7.1.60.0150.01219.46
7.1.50.0210.02534.72
7.1.00.0200.05722.37
7.0.200.0030.01115.18
7.0.140.0070.07321.95
7.0.60.0100.03720.09
7.0.50.0030.04318.03
7.0.40.0230.06320.02
7.0.30.0530.07720.34
7.0.20.0470.05020.15
7.0.10.0100.08720.16
7.0.00.0070.08720.20
5.6.280.0100.07020.98
5.6.210.0030.09020.58
5.6.200.0070.08018.25
5.6.190.0170.05020.49
5.6.180.0230.05320.58
5.6.170.0330.07020.52
5.6.160.0100.05320.40
5.6.150.0000.06718.22
5.6.140.0030.04318.31
5.6.130.0000.09018.15
5.6.120.0100.08721.17
5.6.110.0030.06721.10
5.6.100.0100.08321.14
5.6.90.0000.05321.02
5.6.80.0270.05720.53
5.6.70.4370.05020.55
5.5.350.0230.07720.56
5.5.340.0100.04018.14
5.5.330.0030.05020.32
5.5.320.0330.07020.35
5.5.310.0230.03320.35
5.5.300.0070.03718.05
5.5.290.0230.07018.00
5.5.280.0100.07720.90
5.5.270.0070.05021.00
5.5.260.0000.04720.81
5.5.250.0130.08320.76
5.5.240.0270.07720.17
5.4.450.0900.06019.66
5.4.440.0930.05719.52
5.4.430.0630.06019.63
5.4.420.0830.05719.58
5.4.410.0170.05319.40
5.4.400.0630.06319.18
5.4.390.1100.07319.38
5.4.380.0270.08018.60
5.4.370.0330.07018.66
5.4.360.0400.04718.82
5.4.350.0530.07718.84
5.4.340.0500.07318.88
5.4.320.0100.04112.57
5.4.310.0160.04212.57
5.4.300.0110.03312.57
5.4.290.0080.06412.56
5.4.280.0100.04912.46
5.4.270.0130.03412.46
5.4.260.0050.04412.46
5.4.250.0080.04112.46
5.4.240.0070.03912.46
5.4.230.0080.04012.45
5.4.220.0090.03712.45
5.4.210.0100.05312.46
5.4.200.0060.04112.46
5.4.190.0100.03812.45
5.4.180.0060.04012.45
5.4.170.0120.03512.46
5.4.160.0100.03612.46
5.4.150.0100.03512.45
5.4.140.0090.03612.13
5.4.130.0090.03612.12
5.4.120.0090.03512.08
5.4.110.0070.03912.07
5.4.100.0120.03512.07
5.4.90.0110.03912.07
5.4.80.0110.03912.08
5.4.70.0140.05012.07
5.4.60.0130.03612.07
5.4.50.0080.03612.07
5.4.40.0090.03312.06
5.4.30.0090.03612.07
5.4.20.0080.03512.05
5.4.10.0110.03212.06
5.4.00.0060.03811.54
5.3.290.0110.04512.83
5.3.280.0110.03712.75
5.3.270.0150.04912.76
5.3.260.0060.05712.75
5.3.250.0140.03812.76
5.3.240.0090.04512.76
5.3.230.0080.03912.75
5.3.220.0090.03712.72
5.3.210.0110.03812.72
5.3.200.0110.04212.71
5.3.190.0120.04112.72
5.3.180.0100.04012.71
5.3.170.0100.04112.71
5.3.160.0110.03912.72
5.3.150.0080.04412.71
5.3.140.0170.06512.71
5.3.130.0100.05712.70
5.3.120.0120.05512.70
5.3.110.0160.05012.70
5.3.100.0180.06712.19
5.3.90.0200.08112.17
5.3.80.0140.06412.16
5.3.70.0060.04712.16
5.3.60.0110.05112.15
5.3.50.0130.04212.10
5.3.40.0070.04312.09
5.3.30.0140.04812.06
5.3.20.0090.04911.84
5.3.10.0060.03911.80
5.3.00.0070.04111.79
5.2.170.0090.0339.29
5.2.160.0080.0379.29
5.2.150.0090.0299.29
5.2.140.0060.0339.28
5.2.130.0090.0289.24
5.2.120.0090.0359.25
5.2.110.0070.0319.25
5.2.100.0060.0339.24
5.2.90.0070.0359.24
5.2.80.0060.0349.24
5.2.70.0110.0369.23
5.2.60.0080.0339.20
5.2.50.0090.0349.16
5.2.40.0090.0409.14
5.2.30.0090.0469.11
5.2.20.0110.0399.10
5.2.10.0110.0419.01
5.2.00.0120.0418.87
5.1.60.0050.0428.17
5.1.50.0090.0338.16
5.1.40.0060.0388.14
5.1.30.0110.0258.49
5.1.20.0070.0358.52
5.1.10.0100.0268.24
5.1.00.0070.0288.24
5.0.50.0080.0216.72
5.0.40.0040.0226.58
5.0.30.0070.0336.40
5.0.20.0030.0256.37
5.0.10.0130.0236.34
5.0.00.0070.0436.34
4.4.90.0110.0214.77
4.4.80.0080.0204.75
4.4.70.0080.0204.75
4.4.60.0040.0244.75
4.4.50.0050.0244.77
4.4.40.0090.0314.73
4.4.30.0090.0214.76
4.4.20.0080.0134.84
4.4.10.0060.0164.85
4.4.00.0070.0334.76
4.3.110.0070.0214.67
4.3.100.0100.0184.66
4.3.90.0060.0204.63
4.3.80.0060.0324.63
4.3.70.0060.0224.63
4.3.60.0070.0204.63
4.3.50.0060.0224.63
4.3.40.0070.0314.59
4.3.30.0060.0203.39
4.3.20.0100.0173.38
4.3.10.0060.0213.30
4.3.00.0030.01710.31

preferences:
130.66 ms | 404 KiB | 6 Q