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)); $parsed_url = parse_url($url2); parse_str($parsed_url["query"], $query); var_dump($query); ?>
Output for 5.0.0 - 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(2) { ["c"]=> array(2) { [0]=> string(3) "foo" [1]=> string(3) "bar" } ["baz"]=> string(1) "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/BvDrZ 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/BvDrZ 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/BvDrZ on line 9