3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $url = "http://www.unl.edu/path/path/index.php?test"; $parts = parse_url($url); if (isset($parts['path'])) { $pathinfo = pathinfo($parts['path']); if (isset($pathinfo['extension'])) { $parts['path'] = implode('/',array_pop(explode('/',$parts['path']))); } unset($parts['query']); unset($parts['fragment']); } print_r($parts);
Output for 7.0.0 - 7.1.0
Notice: Only variables should be passed by reference in /in/F9bIm on line 9 Warning: implode(): Invalid arguments passed in /in/F9bIm on line 9 Array ( [scheme] => http [host] => www.unl.edu [path] => )
Output for hhvm-3.10.0 - 3.12.0
Warning: Invalid operand type was used: implode() expects a container as one of the arguments in /in/F9bIm on line 9 Array ( [scheme] => http [host] => www.unl.edu [path] => )
Output for 5.2.5 - 5.6.28
Strict Standards: Only variables should be passed by reference in /in/F9bIm on line 9 Warning: implode(): Invalid arguments passed in /in/F9bIm on line 9 Array ( [scheme] => http [host] => www.unl.edu [path] => )
Output for 5.1.0 - 5.2.4
Strict Standards: Only variables should be passed by reference in /in/F9bIm on line 9 Warning: implode(): Bad arguments. in /in/F9bIm on line 9 Array ( [scheme] => http [host] => www.unl.edu [path] => )
Output for 5.0.5
Fatal error: Only variables can be passed by reference in /in/F9bIm on line 9
Process exited with code 255.
Output for 4.3.2 - 5.0.4
Warning: implode(): Bad arguments. in /in/F9bIm on line 9 Array ( [scheme] => http [host] => www.unl.edu [path] => )
Output for 4.3.0 - 4.3.1
Warning: implode() [http://www.php.net/function.implode]: Bad arguments. in /in/F9bIm on line 9 Array ( [scheme] => http [host] => www.unl.edu [path] => )