3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (PHP_VERSION != '5.3.6') { die("Incorrect version"); } function a($url) { preg_match('!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i', $url, $out); } function b($url) { $out = parse_url($url); } $i = 100000; $start = microtime(true); while (--$i) { a('example.com'); a('example.com/index.php'); a('example.com?foo=bar'); a('/index.php'); a('/index.php?foo=bar'); a('?foo=bar'); } echo microtime(true) - $start . "\n"; $i = 100000; $start = microtime(true); while (--$i) { b('example.com'); b('example.com/index.php'); b('example.com?foo=bar'); b('/index.php'); b('/index.php?foo=bar'); b('?foo=bar'); } echo microtime(true) - $start . "\n";

preferences:
37.04 ms | 402 KiB | 5 Q