- var_dump: documentation ( source)
- parse_url: documentation ( source)
<?php
$x = 'http://example.com/path/to/somewhere?param1=x¶m2=http://another.example.com/path/to/another/example/';
var_dump(parse_url($x));
$y = 'path/to/somewhere?param1=x¶m2=http://another.example.com/path/to/another/example/';
var_dump(parse_url($y));