3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array('foo'=>'bar', 'baz'=>'boom', 'cow'=>'milk', 'php'=>'hypertext processor'); echo uri_appendQuery('http://domena/cesta/subor?query-string', $data), PHP_EOL; echo uri_appendQuery('http://domena/cesta/?query-string', $data), PHP_EOL; echo uri_appendQuery('http://domena/cesta/subor?', $data), PHP_EOL; echo uri_appendQuery('http://domena/cesta/subor', $data), PHP_EOL; echo uri_appendQuery('http://domena/cesta/subor?query-string', $data, TRUE), PHP_EOL; /** * Doplní k URL adrese zadané parametre za otáznikom. * * @param string URL adresa * @param array [názov parametru => hodnota] * @param bool ak je TRUE, nahradia sa všetky & v adrese za &amp; * @return string patrične upravenú URL adresu */ function uri_appendQuery($uri, array $args, $html = FALSE) { if(!$args) { // $args môže byť prázdne pole return $uri; } $sep= $html ? '&amp;' : '&'; if(FALSE === $qmpos = strpos($uri, '?')) { // adresa ešte neobsahuje query string $uri .= '?'; } elseif(strlen($uri) !== ($qmpos + 1)) { // adresa už obsahuje query string $uri .= $sep; } return $uri . http_build_query($args, NULL, $sep); }
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in /in/Srngt on line 36 http://domena/cesta/subor?query-string&foo=bar&baz=boom&cow=milk&php=hypertext+processor Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in /in/Srngt on line 36 http://domena/cesta/?query-string&foo=bar&baz=boom&cow=milk&php=hypertext+processor Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in /in/Srngt on line 36 http://domena/cesta/subor?foo=bar&baz=boom&cow=milk&php=hypertext+processor Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in /in/Srngt on line 36 http://domena/cesta/subor?foo=bar&baz=boom&cow=milk&php=hypertext+processor Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in /in/Srngt on line 36 http://domena/cesta/subor?query-string&amp;foo=bar&amp;baz=boom&amp;cow=milk&amp;php=hypertext+processor

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
17.89 ms | 404 KiB | 8 Q