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)); ?> <a href="?<?= http_build_query(array_merge($query, ['category' => 'val'])) ?>">Категория каталога</a> <a href="?<?= http_build_query(array_merge($query, ['sort' => 'price'])) ?>">Сортировать по цене</a>
Output for 7.2.0
Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in /in/EU8vn on line 3 <a href="? Warning: array_merge(): Argument #1 is not an array in /in/EU8vn on line 5 Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /in/EU8vn on line 5 ">Категория каталога</a> <a href="? Warning: array_merge(): Argument #1 is not an array in /in/EU8vn on line 6 Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /in/EU8vn on line 6 ">Сортировать по цене</a>
Output for 5.4.0 - 7.1.10
<a href="? Warning: array_merge(): Argument #1 is not an array in /in/EU8vn on line 5 Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /in/EU8vn on line 5 ">Категория каталога</a> <a href="? Warning: array_merge(): Argument #1 is not an array in /in/EU8vn on line 6 Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /in/EU8vn on line 6 ">Сортировать по цене</a>
Output for 5.3.18 - 5.3.29
<a href="?<?= http_build_query(array_merge($query, ['category' => 'val'])) ?>">Категория каталога</a> <a href="?<?= http_build_query(array_merge($query, ['sort' => 'price'])) ?>">Сортировать по цене</a>