i have this URI.
i am fetching basename of the URI using following code.
$basename = basename($_SERVER['REQUEST_URI']);
the above code gives me following string.
index.php?properties&status=av&page=1
i would want to remove the last variable from the string i.e &page=1
. please note the value for page
will not always be 1
. keeping this in mind i would want to trim the variable this way.
Trim from the last position of the string till the first delimiter i.e
&
Update :
I would like to remove &page=1
from the string, no matter in which position it is on.
how do i do this?