Hello I have a very simple code
Website
I think you'd better use the built in function parse_url() which returns an associative array with its components
parse_url()
something like this will work for you:
if ( $ret = parse_url($url) ) { if ( !isset($ret["scheme"]) ) { $url = "http://{$url}"; } }