PHP: How can I separate this split this string correctly? -
i have bunch of url segments.
i know either come in form of:
mystring?var1=value
or
mystring/name.php?var1=value
in either case need take url , mystring
bit out of it. will:
- search either first
/
or?
- turn whatever came before var , throw rest of string out.
how can achieved?
a simple way it
$parts = explode('?', $str); $parts = explode('/', $parts[0]); $yourfinalstring = $parts[0];
Comments
Post a Comment