3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function abc($url, $queryString) { $separator = (parse_url($url, PHP_URL_QUERY) === null) ? '?' : '&'; return $url . $separator . $queryString; } echo abc("http://bladsasdlasdlr.gzhu?", "kakakaaa") . "\n"; echo abc("http://bladsasdlasdlr.gzhu?abbb=acccdsds", "kakakaaa") . "\n"; echo abc("http://bladsasdlasdlr.gzhu", "kakakaaa") . "\n";
based on VC9oV
Output for 5.1.2 - 7.2.0
http://bladsasdlasdlr.gzhu??kakakaaa http://bladsasdlasdlr.gzhu?abbb=acccdsds&kakakaaa http://bladsasdlasdlr.gzhu?kakakaaa
Output for 4.3.0 - 5.1.1
Notice: Use of undefined constant PHP_URL_QUERY - assumed 'PHP_URL_QUERY' in /in/0LOeu on line 5 Warning: parse_url() expects exactly 1 parameter, 2 given in /in/0LOeu on line 5 http://bladsasdlasdlr.gzhu??kakakaaa Notice: Use of undefined constant PHP_URL_QUERY - assumed 'PHP_URL_QUERY' in /in/0LOeu on line 5 Warning: parse_url() expects exactly 1 parameter, 2 given in /in/0LOeu on line 5 http://bladsasdlasdlr.gzhu?abbb=acccdsds?kakakaaa Notice: Use of undefined constant PHP_URL_QUERY - assumed 'PHP_URL_QUERY' in /in/0LOeu on line 5 Warning: parse_url() expects exactly 1 parameter, 2 given in /in/0LOeu on line 5 http://bladsasdlasdlr.gzhu?kakakaaa