3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * User connection info * * License: GPL v2 (https://www.gnu.org/licenses/gpl-2.0.html) * * Copyright (C) 2014 Sergey Briskin (http://briskin.org) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ // Create array of values $user = array( 'ip' => $_SERVER['REMOTE_ADDR'], 'host' => (isset($_SERVER['REMOTE_ADDR']) ? gethostbyaddr($_SERVER['REMOTE_ADDR']) : ""), 'port' => $_SERVER['REMOTE_PORT'], 'ua' => $_SERVER['HTTP_USER_AGENT'], 'lang' => $_SERVER['HTTP_ACCEPT_LANGUAGE'], 'mime' => $_SERVER['HTTP_ACCEPT'], 'encoding' => $_SERVER['HTTP_ACCEPT_ENCODING'], 'charset' => $_SERVER['HTTP_ACCEPT_CHARSET'], 'connection' => $_SERVER['HTTP_CONNECTION'], 'cache' => $_SERVER['HTTP_CACHE_CONTROL'], 'cookie' => $_SERVER['HTTP_COOKIE'], 'referer' => $_SERVER['HTTP_REFERER'], 'real_ip' => $_SERVER['HTTP_X_REAL_IP'], 'fwd_ip' => $_SERVER['HTTP_X_FORWARDED_FOR'], 'fwd_host' => (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR']) : ""), 'dnt' => $_SERVER['HTTP_DNT'] ); // Check request (ex. ifconfig.php?q=ip) $query=trim(preg_replace('/ +/', ' ', preg_replace('/[^A-Za-z0-9 ]/', ' ', urldecode(html_entity_decode(strip_tags($_GET['q'])))))); // Return single value on request & die if (isset($query) && array_key_exists($query, $user)) { empty($user[$query]) ? die() : die($user[$query]."\n"); } // Return full output in one of supported formats (html, text, xml, json. default: html) elseif (isset($query) && (($query=="text") || ($query=="all"))) { header('Content-Type: text/plain'); foreach($user as $key => $value) { echo $key.": ".$value."\n"; } die(); } elseif (isset($query) && ($query=="xml")) { header('Content-Type: text/xml'); // Function for SimpleXML creation function array_to_xml(array $arr, SimpleXMLElement $xml) { foreach ($arr as $k => $v) { is_array($v) ? array_to_xml($v, $xml->addChild($k)) : $xml->addChild($k, $v); } return $xml; } echo array_to_xml($user, new SimpleXMLElement('<info/>'))->asXML(); } elseif (isset($query) && ($query=="json")) { header('Content-Type: application/json'); die(json_encode($user)); } else { header('Content-Type: text/html'); ?><!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>info</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/> <style> body { background: #FDFDFD; color: #111; font-size: .9em; } p { font-family: "Source Code Pro", "Droid Mono", "Courier New", "Consolas", "Terminal", fixed; line-height: 1em; } .small, .small > a { font-size: 9pt; color: #777; text-align: center; text-decoration: none; } </style> </head> <body> <? foreach($user as $key => $value) { echo ' <p id="'.$key.'">'.$key.': '.$value.'</p>'."\n"; } ?> <br/> <p class="small">Copyright &copy; 2014 <a href="http://briskin.org">Sergey Briskin</a>.<br/> <a href="https://github.com/sbriskin/ifconfig.php">Get Source code on GitHub</a></p> </body> </html> <? } die(); ?>

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.0070.00718.80
8.3.50.0150.00521.92
8.3.40.0070.00719.02
8.3.30.0110.00419.09
8.3.20.0050.00320.33
8.3.10.0080.00021.82
8.3.00.0000.00818.04
8.2.180.0090.00916.50
8.2.170.0040.01122.96
8.2.160.0140.00020.35
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0050.00226.16
8.2.120.0080.00021.15
8.2.110.0080.00320.42
8.2.100.0040.00817.84
8.2.90.0080.00018.92
8.2.80.0040.00417.97
8.2.70.0030.00517.38
8.2.60.0040.00417.80
8.2.50.0050.00318.07
8.2.40.0020.00518.03
8.2.30.0080.00018.08
8.2.20.0060.00617.62
8.2.10.0070.00017.92
8.2.00.0050.00317.65
8.1.280.0060.00925.92
8.1.270.0090.00023.91
8.1.260.0000.00726.35
8.1.250.0020.00528.09
8.1.240.0030.00620.89
8.1.230.0040.00817.45
8.1.220.0050.00317.74
8.1.210.0030.00618.77
8.1.200.0100.00017.10
8.1.190.0060.00317.10
8.1.180.0050.00218.10
8.1.170.0020.00718.50
8.1.160.0030.00521.93
8.1.150.0070.00018.64
8.1.140.0040.00417.38
8.1.130.0000.00817.81
8.1.120.0040.00417.32
8.1.110.0040.00417.35
8.1.100.0000.00717.33
8.1.90.0050.00317.37
8.1.80.0030.00517.32
8.1.70.0030.00317.25
8.1.60.0000.00817.29
8.1.50.0030.00617.45
8.1.40.0030.00517.35
8.1.30.0000.00817.57
8.1.20.0000.00717.55
8.1.10.0030.00617.38
8.1.00.0080.00017.38
8.0.300.0040.00418.77
8.0.290.0000.00916.75
8.0.280.0030.00318.40
8.0.270.0070.00017.24
8.0.260.0030.00317.20
8.0.250.0000.00716.95
8.0.240.0030.00616.98
8.0.230.0000.00716.97
8.0.220.0030.00316.86
8.0.210.0000.00716.91
8.0.200.0060.00016.98
8.0.190.0070.00016.91
8.0.180.0000.00716.96
8.0.170.0070.00016.87
8.0.160.0000.00716.89
8.0.150.0050.00316.87
8.0.140.0070.00016.90
8.0.130.0030.00513.55
8.0.120.0070.00016.91
8.0.110.0040.00416.88
8.0.100.0040.00416.75
8.0.90.0000.00716.84
8.0.80.0090.00616.84
8.0.70.0000.00716.76
8.0.60.0000.00716.85
8.0.50.0000.00716.96
8.0.30.0140.00616.97
8.0.20.0140.00817.40
8.0.10.0030.00716.95
8.0.00.0060.01116.81
7.4.330.0050.00015.11
7.4.320.0060.00016.36
7.4.300.0070.00016.39
7.4.290.0070.00016.35
7.4.280.0050.00216.50
7.4.270.0000.00716.41
7.4.260.0070.00016.43
7.4.250.0000.00816.41
7.4.240.0020.00516.48
7.4.230.0000.00716.47
7.4.220.0030.01216.41
7.4.210.0050.01416.55
7.4.200.0030.00316.48
7.4.160.0100.00616.16
7.4.150.0130.00417.40
7.4.140.0100.00617.86
7.4.130.0110.00816.40
7.4.120.0090.01016.37
7.4.110.0110.00616.23
7.4.100.0070.01016.42
7.4.90.0130.00416.26
7.4.80.0160.00319.39
7.4.70.0090.01016.32
7.4.60.0000.01816.32
7.4.50.0030.00516.58
7.4.40.0080.00916.41
7.4.30.0110.00516.61
7.4.00.0090.00314.76
7.3.330.0000.00513.60
7.3.320.0060.00013.63
7.3.310.0070.00015.96
7.3.300.0070.00016.23
7.3.290.0030.01016.14
7.3.280.0080.00716.16
7.3.270.0070.01017.40
7.3.260.0140.00316.19
7.3.250.0170.00416.29
7.3.240.0060.01116.11
7.3.230.0140.00316.39
7.3.210.0080.01516.14
7.3.200.0090.00619.39
7.3.190.0110.00716.20
7.3.180.0140.00716.09
7.3.170.0030.01316.36
7.3.160.0070.01016.21
7.3.120.0070.01014.70
7.2.330.0140.00316.25
7.2.320.0140.00316.44
7.2.310.0090.00616.15
7.2.300.0060.01216.33
7.2.290.0100.00616.36
5.5.150.0060.00311.44
5.5.140.0040.00711.54
5.5.130.0050.00511.45
5.5.120.0060.00511.11
5.5.110.0080.00411.15
5.5.100.0060.00611.36
5.5.90.0060.00611.50
5.5.80.0060.00611.34
5.5.70.0060.00611.48
5.5.60.0140.00011.29
5.5.50.0090.00411.26
5.5.40.0030.00911.48
5.5.30.0060.00611.18
5.5.20.0030.00911.25
5.5.10.0030.00811.11
5.5.00.0040.00811.12
5.4.310.0080.00411.03
5.4.300.0060.00311.35
5.4.290.0080.00311.24
5.4.280.0060.00311.40
5.4.270.0080.00411.34
5.4.260.0030.00611.11
5.4.250.0070.00211.23
5.4.240.0030.01011.11
5.4.230.0050.00511.05
5.4.220.0040.00711.16
5.4.210.0000.01311.37
5.4.200.0060.00310.91
5.4.190.0030.00910.95
5.4.180.0030.00711.04
5.4.170.0070.00411.23
5.4.160.0050.00511.04
5.4.150.0070.00410.87
5.4.140.0080.00411.20
5.4.130.0030.01211.13
5.4.120.0070.00711.07
5.4.110.0080.00311.26
5.4.100.0060.00711.15
5.4.90.0060.00611.08
5.4.80.0080.00411.04
5.4.70.0050.00611.31
5.4.60.0000.01110.86
5.4.50.0060.00911.34
5.4.40.0040.00711.41
5.4.30.0060.00311.33
5.4.20.0000.01411.03
5.4.10.0030.00811.11
5.4.00.0030.00611.31
5.3.280.0060.00510.25
5.3.270.0050.00310.13
5.3.260.0030.00710.32
5.3.250.0040.00410.27
5.3.240.0070.00310.19
5.3.230.0030.00310.28
5.3.220.0090.00010.30
5.3.210.0030.00610.33
5.3.200.0050.00610.31
5.3.190.0030.00710.24
5.3.180.0030.00610.49
5.3.170.0090.00010.42
5.3.160.0050.00210.18
5.3.150.0040.00410.32
5.3.140.0070.00010.16
5.3.130.0070.00310.33
5.3.120.0030.00710.34
5.3.110.0060.00310.39
5.3.100.0000.00810.30
5.3.90.0040.00410.32
5.3.80.0080.00310.38
5.3.70.0070.00310.26
5.3.60.0060.00310.34
5.3.50.0080.00010.25
5.3.40.0030.00610.30
5.3.30.0070.00310.36
5.3.20.0060.00310.24
5.3.10.0050.00510.03
5.3.00.0000.0129.93
5.2.170.0080.0009.23
5.2.160.0060.0039.35
5.2.150.0030.0039.23
5.2.140.0000.0099.32
5.2.130.0090.0009.04
5.2.120.0030.0089.40
5.2.110.0050.0069.29
5.2.100.0000.0099.16
5.2.90.0030.0069.32
5.2.80.0060.0039.22
5.2.70.0070.0009.22
5.2.60.0030.0038.98
5.2.50.0000.0089.06
5.2.40.0000.0089.27
5.2.30.0030.0039.24
5.2.20.0030.0069.07
5.2.10.0050.0038.84
5.2.00.0040.0049.04
5.1.60.0060.0038.84
5.1.50.0040.0048.84
5.1.40.0040.0028.84
5.1.30.0000.0098.84
5.1.20.0030.0038.84
5.1.10.0080.0008.84
5.1.00.0030.0058.84
5.0.50.0030.0038.84
5.0.40.0050.0028.84
5.0.30.0030.0038.84
5.0.20.0000.0078.84
5.0.10.0030.0038.84
5.0.00.0040.0048.84
4.4.90.0020.0058.84
4.4.80.0030.0038.84
4.4.70.0000.0048.84
4.4.60.0000.0068.84
4.4.50.0000.0058.84
4.4.40.0030.0038.84
4.4.30.0030.0038.84
4.4.20.0000.0058.84
4.4.10.0000.0068.84
4.4.00.0030.0068.84
4.3.110.0000.0078.84
4.3.100.0050.0008.84
4.3.90.0050.0008.84
4.3.80.0000.0068.84
4.3.70.0000.0068.84
4.3.60.0030.0038.84
4.3.50.0000.0048.84
4.3.40.0030.0038.84
4.3.30.0030.0038.84
4.3.20.0040.0008.84
4.3.10.0000.0058.84
4.3.00.0030.0038.84

preferences:
38.76 ms | 401 KiB | 5 Q