3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $url = 'http://mysite.com/hello/world?look_at=me'; $query = parse_str(parse_url($url, PHP_URL_QUERY)); var_dump($query); ?> <a href="?<?= http_build_query(array_merge($query, ['category' => 'val'])) ?>">Категория каталога</a> <a href="?<?= http_build_query(array_merge($query, ['sort' => 'price'])) ?>">Сортировать по цене</a>
based on EU8vn
Output for 7.2.0
Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in /in/Z59W1 on line 3 NULL <a href="? Warning: array_merge(): Argument #1 is not an array in /in/Z59W1 on line 6 Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /in/Z59W1 on line 6 ">Категория каталога</a> <a href="? Warning: array_merge(): Argument #1 is not an array in /in/Z59W1 on line 7 Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /in/Z59W1 on line 7 ">Сортировать по цене</a>
Output for 5.4.0 - 7.1.10
NULL <a href="? Warning: array_merge(): Argument #1 is not an array in /in/Z59W1 on line 6 Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /in/Z59W1 on line 6 ">Категория каталога</a> <a href="? Warning: array_merge(): Argument #1 is not an array in /in/Z59W1 on line 7 Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /in/Z59W1 on line 7 ">Сортировать по цене</a>
Output for 5.3.18 - 5.3.29
NULL <a href="?<?= http_build_query(array_merge($query, ['category' => 'val'])) ?>">Категория каталога</a> <a href="?<?= http_build_query(array_merge($query, ['sort' => 'price'])) ?>">Сортировать по цене</a>