3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $url = 'http://username:password@hostname/path?arg=value&key=value2#anchor'; $ss_url_args = parse_url($url, PHP_URL_QUERY); $pieces = explode("&", $ss_url_args); for($i = 0; $i < count($peices); $i++) { $args = explode("=", $peices[$i]); if($args[0] === 'key') { $key = $args[1]; } } echo $key;
Output for 5.1.2 - 7.1.0
Notice: Undefined variable: peices in /in/pkoo8 on line 7 Notice: Undefined variable: key in /in/pkoo8 on line 15
Output for 5.0.4 - 5.1.1
Notice: Use of undefined constant PHP_URL_QUERY - assumed 'PHP_URL_QUERY' in /in/pkoo8 on line 5 Warning: parse_url() expects exactly 1 parameter, 2 given in /in/pkoo8 on line 5 Notice: Undefined variable: peices in /in/pkoo8 on line 7 Notice: Undefined variable: key in /in/pkoo8 on line 15
Output for 4.3.0 - 5.0.3
Notice: Use of undefined constant PHP_URL_QUERY - assumed 'PHP_URL_QUERY' in /in/pkoo8 on line 5 Warning: parse_url() expects exactly 1 parameter, 2 given in /in/pkoo8 on line 5 Notice: Undefined variable: peices in /in/pkoo8 on line 7 Notice: Undefined variable: key in /in/pkoo8 on line 15