3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $url = "http://localhost/satdb/src/?v=organisations&q=foo&s=p&o=a&p=2?g=a"; //var_dump(explode("?", $url)); $parsed_url = parse_url($url); $query = array(); parse_str($parsed_url["query"], $query); $query["q"] = "bar"; var_dump($query); $url2 = "http://foo.lol/bar?".http_build_query(array("c" => array("foo", "bar"), "baz" => 0)); var_dump(parse_url($url2)); ?>
Output for 5.1.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(5) { ["v"]=> string(13) "organisations" ["q"]=> string(3) "bar" ["s"]=> string(1) "p" ["o"]=> string(1) "a" ["p"]=> string(5) "2?g=a" } array(4) { ["scheme"]=> string(4) "http" ["host"]=> string(7) "foo.lol" ["path"]=> string(4) "/bar" ["query"]=> string(31) "c%5B0%5D=foo&c%5B1%5D=bar&baz=0" }
Output for 5.0.0 - 5.1.2
array(5) { ["v"]=> string(13) "organisations" ["q"]=> string(3) "bar" ["s"]=> string(1) "p" ["o"]=> string(1) "a" ["p"]=> string(5) "2?g=a" } array(4) { ["scheme"]=> string(4) "http" ["host"]=> string(7) "foo.lol" ["path"]=> string(4) "/bar" ["query"]=> string(23) "c[0]=foo&c[1]=bar&baz=0" }
Output for 4.4.5 - 4.4.9
array(5) { ["v"]=> string(13) "organisations" ["q"]=> string(3) "bar" ["s"]=> string(1) "p" ["o"]=> string(1) "a" ["p"]=> string(5) "2?g=a" } Fatal error: Call to undefined function: http_build_query() in /in/8cMbI on line 9
Process exited with code 255.
Output for 4.3.2 - 4.4.4
array(5) { ["v"]=> string(13) "organisations" ["q"]=> string(3) "bar" ["s"]=> string(1) "p" ["o"]=> string(1) "a" ["p"]=> string(5) "2?g=a" } Fatal error: Call to undefined function: http_build_query() in /in/8cMbI on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
array(5) { ["v"]=> string(13) "organisations" ["q"]=> string(3) "bar" ["s"]=> string(1) "p" ["o"]=> string(1) "a" ["p"]=> string(5) "2?g=a" } Fatal error: Call to undefined function: http_build_query() in /in/8cMbI on line 9