How can I utilize preg_replace
in PHP to parse a url.
Say I have the url
and I want to access each part of the url such that
echo $protocol;
would print
http
or
echo $domain;
would print
google
and
echo $upperDomain;
prints
com
and finally,
echo $rest;
would print
?id=123