3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* MikroGlass - Mikrotik looking glass. For the web. Copyright (C) 2013 Tom Hetmer (http://tom.hetmer.cz) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ header('Content-Type: application/json'); function fail($why) { echo json_encode(array( 'error' => $why )); exit(); } $config = parse_ini_file("config.ini.php"); $user = $config['user']; $password = $config['password']; $tools = array( 'ping' => '/ping count=4', 'trace' => '/tool traceroute duration=3 use-dns=yes', 'exactroute' => '/ip r pr de where dst-address=', 'ipv4-route-info' => '/ip route print', 'ipv6-route-info' => '/ipv6 route print', 'bgp-peer' => '/routing bgp peer print', //Commented out by default to disallow any chance for users to see BGP peer password details etc //'bgp-status' => '/routing bgp peer print status', 'ospf-neighbor' => '/routing ospf neigh print', 'v4-neighbor' => '/ip neigh pr de', 'v6-neighbor' => '/ipv6 neigh pr', ); $type = $_POST['type']; // type of command (ping, trace, ..) $tool = $tools[$type]; // command syntax $argument = $_POST['command']; // user's argument $server = $config['fqdn'][$_POST['id']];// resolve FQDN host $exec = $tool; // simple commands execute immediately if (!$tool || !$server) { // Does not match our tool or server arrays. fail('Wrong parameters.'); } if ($type == 'ping' || $type == 'trace' || $type == 'exactroute') { // We need argument for these tools if (empty($argument)) { fail('Empty parameter.'); } // BGP route can't have space if ($type == 'exactroute') { $space = ''; } else { $space = ' '; } // Need to sanitize hostname if ($type == 'ping' || $type == 'trace') { // Always returns safely with IP, even for IPs $host = gethostbynamel($argument); if($host) { $argument = $host[0]; } else { fail('Wrong hostname.'); } } $exec = $tool . $space . escapeshellcmd($argument); } // Can't really ssh with passwords // Key auth works. if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' && empty($config['password'])) { // Linux, no password/keys, let's ssh $fp = popen('ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ' . $user . '@' . $server . ' ' . $exec, 'r'); } else { // Putty Link fallback (Linux, Windows) $fp = popen($config['path'] . ' -ssh -l ' . $user . ' -pw ' . $password . ' ' . $server . ' ' . $exec, 'r'); } // Handle stream $out = null; while (!feof($fp)) { $out .= fgets($fp); } pclose($fp); // Return result and our command for display echo json_encode(array( 'command' => $exec, 'result' => $out )); ?>

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.0100.00618.43
8.3.50.0090.01222.05
8.3.40.0150.00318.92
8.3.30.0120.00618.74
8.3.20.0050.00318.93
8.3.10.0000.00821.08
8.3.00.0000.00723.66
8.2.180.0120.00616.75
8.2.170.0060.00922.96
8.2.160.0150.00322.27
8.2.150.0120.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00421.11
8.2.110.0060.00322.29
8.2.100.0040.00818.03
8.2.90.0040.00419.21
8.2.80.0000.00719.21
8.2.70.0000.00917.63
8.2.60.0080.00018.05
8.2.50.0080.00018.07
8.2.40.0050.00317.97
8.2.30.0070.00019.36
8.2.20.0040.00417.89
8.2.10.0030.00517.95
8.2.00.0050.00317.80
8.1.270.0070.00023.99
8.1.260.0090.00326.35
8.1.250.0060.00328.09
8.1.240.0090.00022.54
8.1.230.0090.00320.78
8.1.220.0040.00418.77
8.1.210.0040.00418.92
8.1.200.0060.00617.36
8.1.190.0050.00317.53
8.1.180.0000.00818.10
8.1.170.0000.00918.53
8.1.160.0070.00018.84
8.1.150.0040.00418.61
8.1.140.0000.00817.50
8.1.130.0030.00317.82
8.1.120.0040.00417.57
8.1.110.0000.00717.46
8.1.100.0020.00517.41
8.1.90.0040.00417.54
8.1.80.0030.00517.40
8.1.70.0030.00517.37
8.1.60.0000.00917.71
8.1.50.0000.00817.46
8.1.40.0050.00317.66
8.1.30.0040.00417.83
8.1.20.0000.00917.63
8.1.10.0050.00317.68
8.1.00.0030.00517.61
8.0.300.0000.00920.14
8.0.290.0000.00717.41
8.0.280.0000.00718.55
8.0.270.0040.00417.36
8.0.260.0030.00316.99
8.0.250.0070.00017.06
8.0.240.0040.00417.10
8.0.230.0030.00317.08
8.0.220.0030.00317.02
8.0.210.0040.00416.93
8.0.200.0030.00317.09
8.0.190.0050.00217.03
8.0.180.0040.00417.07
8.0.170.0050.00317.15
8.0.160.0040.00416.96
8.0.150.0040.00417.13
8.0.140.0040.00417.03
8.0.130.0030.00313.52
8.0.120.0030.00617.01
8.0.110.0000.00817.04
8.0.100.0040.00416.87
8.0.90.0040.00416.88
8.0.80.0110.00417.06
8.0.70.0000.00717.06
8.0.60.0040.00416.86
8.0.50.0050.00317.13
8.0.30.0080.01617.33
8.0.20.0090.01217.40
8.0.10.0070.00017.08
8.0.00.0110.00716.71
7.4.330.0000.00516.67
7.4.320.0030.00316.64
7.4.300.0040.00416.53
7.4.290.0030.00316.48
7.4.280.0030.00616.54
7.4.270.0030.00316.63
7.4.260.0030.00313.30
7.4.250.0000.00716.60
7.4.240.0030.00316.69
7.4.230.0030.00316.62
7.4.220.0190.00616.43
7.4.210.0070.00916.63
7.4.200.0030.00316.68
7.4.190.0000.00716.43
7.4.160.0040.01216.50
7.4.150.0090.00917.40
7.4.140.0080.01117.86
7.4.130.0150.00116.68
7.4.120.0140.00316.54
7.4.110.0100.01316.54
7.4.100.0060.01216.59
7.4.90.0050.01316.57
7.4.80.0110.00819.39
7.4.70.0040.01816.73
7.4.60.0120.00616.45
7.4.50.0060.00316.20
7.4.40.0000.01422.77
7.4.30.0140.00416.45
7.4.00.0060.00615.15
7.3.330.0050.00013.42
7.3.320.0000.00613.48
7.3.310.0030.00316.53
7.3.300.0000.00716.43
7.3.290.0100.00716.49
7.3.280.0070.00916.49
7.3.270.0120.00617.40
7.3.260.0120.00918.24
7.3.250.0140.00616.44
7.3.240.0110.00816.51
7.3.230.0120.00616.46
7.3.210.0060.01216.61
7.3.200.0030.01419.39
7.3.190.0040.01316.66
7.3.180.0170.00716.64
7.3.170.0090.01216.79
7.3.160.0080.00816.71
7.3.120.0030.01014.92
7.2.330.0130.00416.71
7.2.320.0180.00416.70
7.2.310.0160.00316.73
7.2.300.0120.00616.52
7.2.290.0100.00616.64
7.2.60.0060.00616.97
7.1.200.0090.00315.63
7.1.70.0040.00417.09
7.1.60.0000.01117.37
7.1.50.0110.01116.65
7.1.00.0000.03722.45
7.0.200.0000.00816.63
7.0.140.0030.07322.10
7.0.90.0630.08719.94
7.0.80.0500.05019.97
7.0.70.0470.05019.88
7.0.60.0470.08719.89
7.0.50.0530.04020.38
7.0.40.0030.06720.08
7.0.30.0070.05720.07
7.0.20.0070.08020.13
7.0.10.0130.05020.07
7.0.00.0130.07720.02
5.6.280.0030.07320.90
5.6.240.0170.07720.74
5.6.230.0000.04720.54
5.6.220.0030.08020.63
5.6.210.0070.04720.70
5.6.200.0070.08321.12
5.6.190.0130.07021.09
5.6.180.0100.08321.12
5.6.170.0230.05021.04
5.6.160.0070.06320.96
5.6.150.0070.05321.12
5.6.140.0000.09021.06
5.6.130.0130.07721.12
5.6.120.0100.07321.03
5.6.110.0130.04721.09
5.6.100.0170.06320.89
5.6.90.0070.08321.00
5.6.80.0030.07320.35
5.6.70.0070.04320.45
5.6.60.0100.07720.34
5.6.50.0130.04720.35
5.6.40.0070.04020.40
5.6.30.0130.07320.46
5.6.20.0030.08720.38
5.6.10.0130.05320.55
5.6.00.0030.09020.47
5.5.380.0030.06720.41
5.5.370.0170.04720.58
5.5.360.0170.07720.36
5.5.350.0070.08720.35
5.5.340.0100.03720.81
5.5.330.0130.07320.81
5.5.320.0130.07720.73
5.5.310.0070.09020.77
5.5.300.0030.08020.94
5.5.290.0000.06320.84
5.5.280.0130.05720.92
5.5.270.0130.07320.76
5.5.260.0000.08720.80
5.5.250.0130.05020.76
5.5.240.0070.04020.14
5.5.230.0070.04320.21
5.5.220.0130.06720.21
5.5.210.0170.07720.29
5.5.200.0130.05720.16
5.5.190.0100.08020.24
5.5.180.0100.09020.01
5.5.160.0170.06020.19
5.5.150.0070.06020.00
5.5.140.0070.07320.20
5.5.130.0000.09020.12
5.5.120.0100.07720.12
5.5.110.0030.08320.22
5.5.100.0000.04720.11
5.5.90.0170.06719.98
5.5.80.0070.04320.02
5.5.70.0070.07719.95
5.5.60.0130.07020.17
5.5.50.0070.08020.07
5.5.40.0030.04720.07
5.5.30.0070.05320.04
5.5.20.0100.07720.01
5.5.10.0100.07720.03
5.5.00.0000.04719.99
5.4.450.0100.04319.34
5.4.440.0030.04719.49
5.4.430.0070.08319.38
5.4.420.0200.06719.33
5.4.410.0030.05319.05
5.4.400.0000.04718.86
5.4.390.0170.06718.86
5.4.380.0100.07318.88
5.4.370.0100.07718.90
5.4.360.0030.04019.14
5.4.350.0030.07719.17
5.4.340.0000.08019.13
5.4.320.0100.07719.24
5.4.310.0070.05719.03
5.4.300.0070.07319.14
5.4.290.0130.07319.13
5.4.280.0100.05019.18
5.4.270.0100.07719.21
5.4.260.0030.08019.21
5.4.250.0030.06719.13
5.4.240.0070.04019.09
5.4.230.0130.07018.95
5.4.220.0000.06319.16
5.4.210.0030.06018.85
5.4.200.0100.03319.04
5.4.190.0070.06018.95
5.4.180.0030.07719.16
5.4.170.0100.06019.04
5.4.160.0030.08018.89
5.4.150.0170.07719.02
5.4.140.0070.07316.17
5.4.130.0030.07016.37
5.4.120.0070.07316.36
5.4.110.0030.05316.40
5.4.100.0130.06716.52
5.4.90.0070.07316.36
5.4.80.0070.04316.33
5.4.70.0000.05716.42
5.4.60.0030.07716.48
5.4.50.0130.04316.34
5.4.40.0130.03716.47
5.4.30.0030.06716.41
5.4.20.0070.04716.48
5.4.10.0000.05016.36
5.4.00.0070.03715.82
5.3.290.0130.05014.67
5.3.280.0100.05014.57
5.3.270.0100.06314.59
5.3.260.0070.07014.57
5.3.250.0070.06714.59
5.3.240.0100.07014.74
5.3.230.0070.06714.62
5.3.220.0070.08014.71
5.3.210.0000.05314.53
5.3.200.0070.07314.54
5.3.190.0030.05314.57
5.3.180.0070.05714.52
5.3.170.0100.06714.57
5.3.160.0070.06714.52
5.3.150.0000.08014.58
5.3.140.0100.04714.68
5.3.130.0100.07314.54
5.3.120.0100.07014.55
5.3.110.0100.07314.63
5.3.100.0070.04014.09
5.3.90.0070.06714.09
5.3.80.0070.07013.93
5.3.70.0000.08014.07
5.3.60.0030.07013.91
5.3.50.0030.07714.07
5.3.40.0070.04714.04
5.3.30.0100.07714.00
5.3.20.0070.05013.64
5.3.10.0070.07313.77
5.3.00.0070.05713.65
5.2.170.0030.05711.23
5.2.160.0070.03711.19
5.2.150.0100.04011.03
5.2.140.0030.04711.10
5.2.130.0030.04711.14
5.2.120.0030.04011.13
5.2.110.0070.05711.18
5.2.100.0000.04011.16
5.2.90.0030.05711.04
5.2.80.0130.02711.19
5.2.70.0070.06011.03
5.2.60.0070.06011.14
5.2.50.0030.06311.13
5.2.40.0170.05011.09
5.2.30.0070.04711.07
5.2.20.0000.06311.09
5.2.10.0030.06010.98
5.2.00.0070.05310.68
5.1.60.0100.03710.05
5.1.50.0130.04010.02
5.1.40.0000.05710.08
5.1.30.0000.04310.49
5.1.20.0100.05010.32
5.1.10.0100.03710.16
5.1.00.0100.03310.17
5.0.50.0130.0338.69
5.0.40.0070.0408.29
5.0.30.0070.0678.11
5.0.20.0030.0438.27
5.0.10.0070.0338.05
5.0.00.0030.0638.27
4.4.90.0030.0177.61
4.4.80.0100.0177.61
4.4.70.0000.0277.61
4.4.60.0070.0377.61
4.4.50.0000.0277.61
4.4.40.0000.0537.61
4.4.30.0000.0377.61
4.4.20.0030.0377.61
4.4.10.0030.0377.61
4.4.00.0030.0477.61
4.3.110.0000.0377.61
4.3.100.0070.0307.61
4.3.90.0000.0377.61
4.3.80.0000.0307.61
4.3.70.0070.0307.61
4.3.60.0030.0237.61
4.3.50.0000.0237.61
4.3.40.0000.0277.61
4.3.30.0000.0307.61
4.3.20.0030.0337.61
4.3.10.0000.0277.61
4.3.00.0070.0307.61

preferences:
59.89 ms | 400 KiB | 5 Q