3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! $uri = "http://fashion/ru/items/2?sort%5B%5D=1&str%5B%5D=4&curs%5B%5D=1&page=2&page=1&page=2&page=5&page=4&page=3&page=2&page=1&page=1&page=1&page=1&page=1&page=1&page=1&page=1&page=1&page=1&page=1&tesdsd=2"; function sgp($url, $varname, $value) // substitute get parameter { if (is_array($varname)) { foreach ($varname as $i => $n) { $v = (is_array($value)) ? ( isset($value[$i]) ? $value[$i] : NULL ) : $value; $url = sgp($url, $n, $v); } return $url; } preg_match('/^([^?]+)(\?.*?)?(#.*)?$/', $url, $matches); $gp = (isset($matches[2])) ? $matches[2] : ''; // GET-parameters if (!$gp) return $url; $pattern = "/([?&])$varname=.*?(?=&|#|\z)/"; if (preg_match($pattern, $gp)) { $substitution = ($value !== '') ? "\${1}$varname=" . preg_quote($value) : ''; $newgp = preg_replace($pattern, $substitution, $gp); // new GET-parameters $newgp = preg_replace('/^&/', '?', $newgp); } else { $s = ($gp) ? '&' : '?'; $newgp = $gp.$s.$varname.'='.$value; } $anchor = (isset($matches[3])) ? $matches[3] : ''; $newurl = $matches[1].$newgp.$anchor; return $newurl; } var_dump(sgp($uri,array('page'),array(1));

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)
5.4.170.0270.03319.60
5.4.160.0370.04019.60
5.4.150.0570.03719.60
5.4.140.0570.04319.60
5.4.130.0600.04319.60
5.4.120.0470.04319.46
5.4.110.0370.04019.22
5.4.100.0570.03319.22
5.4.90.0330.04319.22
5.4.80.0370.04319.19
5.4.70.0370.03719.03
5.4.60.0270.03319.03
5.4.50.0370.03019.03
5.4.40.0370.02019.03
5.4.30.0430.03719.03
5.4.20.0470.04019.03
5.4.10.0570.03318.99
5.4.00.0530.03318.99
5.3.270.0600.05019.60
5.3.260.0470.03719.60
5.3.250.0600.03719.60
5.3.240.0800.04019.60
5.3.230.0630.03019.46
5.3.220.0670.04319.46
5.3.210.0300.04719.46
5.3.200.0470.03319.22
5.3.190.0470.03319.19
5.3.180.0430.03319.19
5.3.170.0430.03719.03
5.3.160.0330.04019.03
5.3.150.0300.03019.03
5.3.140.0270.04319.03
5.3.130.0400.04319.03
5.3.120.0470.04319.03
5.3.110.0470.04318.99
5.3.100.0530.03718.92
5.3.90.0270.03318.92
5.3.80.0870.04718.92
5.3.70.0370.03018.92
5.3.60.0300.04018.92
5.3.50.0270.04318.92
5.3.40.0300.03718.89
5.3.30.0330.04018.89
5.3.20.0700.03318.89
5.3.10.0330.04018.30
5.3.00.0330.04718.30

preferences:
137.19 ms | 1394 KiB | 7 Q