3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (substr(PHP_VERSION, 0, 5) !== '7.1.6') die('Meh'); $s["HTTP_HOST"] = "localhost"; $s["HTTP_CONNECTION"] = "keep-alive"; $s["HTTP_USER_AGENT"] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11"; $s["HTTP_ACCEPT"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; $s["HTTP_REFERER"] = "http://localhost/php/super-variables/;\$s.php"; $s["HTTP_ACCEPT_ENCODING"] = "gzip,deflate,sdch"; $s["HTTP_ACCEPT_LANGUAGE"] = "en-US,en;q=0.8"; $s["HTTP_ACCEPT_CHARSET"] = "ISO-8859-1,utf-8;q=0.7,*;q=0.3"; $s["HTTP_COOKIE"] = "bsau=13422601771944046296; bsas=13422601771975238542"; $s["PATH"] = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem; C:\Windows\System32\WindowsPowerShell\v1.0\; c:\python32\python;"; $s["SystemRoot"] = "C:\Windows"; $s["COMSPEC"] = "C:\Windows\system32\cmd.exe"; $s["PATHEXT"] = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"; $s["WINDIR"] = "C:\Windows"; $s["SERVER_SIGNATURE"] = ""; $s["SERVER_SOFTWARE"] = "Apache/2.2.11 (Win32) PHP/5.3.0"; $s["SERVER_NAME"] = "localhost"; $s["SERVER_ADDR"] = "127.0.0.1"; $s["SERVER_PORT"] = "80"; $s["REMOTE_ADDR"] = "127.0.0.1"; $s["DOCUMENT_ROOT"] = "F:/wamp/www/"; $s["SERVER_ADMIN"] = "admin@localhost"; $s["SCRIPT_FILENAME"] = "F:/wamp/www/php/super-variables/test-;\$s.php"; $s["REMOTE_PORT"] = "51124"; $s["GATEWAY_INTERFACE"] = "CGI/1.1"; $s["SERVER_PROTOCOL"] = "HTTP/1.1"; $s["REQUEST_METHOD"] = "GET"; $s["QUERY_STRING"] = ""; $s["REQUEST_URI"] = "/php/super-variables/test-;\$s.php"; $s["SCRIPT_NAME"] = "/php/super-variables/test-;\$s.php"; $s["PHP_SELF"] = "/php/super-variables/test-;\$s.php"; $s["REQUEST_TIME"] = 1342260551; $a = microtime(1); for ($i = 20000; $i--;) { foreach ($s as $key => $val) { if ($key[0] === 'H' && substr($key, 0, 5) === 'HTTP_') { $key = substr($key, 5); } } } echo 1000 * (microtime(1) - $a) . "\n"; $a = microtime(1); for ($i = 20000; $i--;) { foreach ($s as $key => $val) { if (substr($key, 0, 5) === 'HTTP_') { $key = substr($key, 5); } } } echo 1000 * (microtime(1) - $a) . "\n";
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.5, 7.1.7 - 7.1.25, 7.2.0 - 7.2.13, 7.3.0 - 7.3.1
Meh
Output for 7.1.6
75.443029403687 74.125051498413

preferences:
73.12 ms | 401 KiB | 51 Q