<?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";
- Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.5, 5.3.7 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7
- Incorrect version
- Output for 5.3.6
- 1.3243689537048
0.39697003364563
preferences:
122.3 ms | 401 KiB | 173 Q