3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 ggp($url) { // get GET-parameters string preg_match('/^([^?]+)(\?.*?)?(#.*)?$/', $url, $matches); $gp = (isset($matches[2])) ? $matches[2] : ''; return $gp; } function deleted($url) { // get GET-parameters string preg_match('/^([^&page=])(*)?$/', $url, $matches); $gp = (isset($matches[2])) ? $matches[2] : ''; return $gp; } echo ggp($uri); echo deleted($uri);
Output for 4.3.11 - 5.6.28, 7.0.0 - 7.1.0
?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 Warning: preg_match(): Compilation failed: nothing to repeat at offset 13 in /in/nYFCU on line 12
Output for 4.3.0 - 4.3.10, hhvm-3.10.0 - 3.12.0
?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 Warning: Compilation failed: nothing to repeat at offset 13 in /in/nYFCU on line 12