3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function custom_parse_url($url, $dummy_scheme = '') { if (version_compare(phpversion(), '7.0.0beta1') < 0) { $url_parts = parse_url($dummy_scheme.$url); if (isset($url_parts['scheme']) && $url_parts['scheme'] == $dummy_scheme) { unset($url_parts['scheme']); } return $url_parts; } else { return parse_url($url); } } $url = "_search?q=sku:89399"; var_dump(custom_parse_url($url, 'test://'));
based on 8NaYL
Output for 7.0.0 - 7.2.0
array(2) { ["path"]=> string(7) "_search" ["query"]=> string(11) "q=sku:89399" }
Output for 5.3.20 - 5.6.28
array(3) { ["scheme"]=> string(4) "test" ["host"]=> string(7) "_search" ["query"]=> string(11) "q=sku:89399" }