3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $queryString = '/post.php?foo=5&bar=&baz=2&bee=&fee=&feo=8'; $queryUrl = parse_url($queryString); //path, query parse_str($queryUrl['query'], $args); $args = array_filter($args); $queryString = $queryUrl['path'].(count($args) ?'?'.http_build_query($args) :''); var_dump($queryString);
Output for 5.0.0 - 7.1.0
string(27) "/post.php?foo=5&baz=2&feo=8"
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: http_build_query() in /in/7hFm4 on line 8
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: http_build_query() in /in/7hFm4 on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: http_build_query() in /in/7hFm4 on line 8