I actually think that's not the good way to parse it. It's not clean or it's a bit out of subject ...
- Explode is heavy
- Session is heavy
- PHP_SELF doesn't handle URLRewriting
I'd do something like ...
if ($pos_get = strpos($app_uri, '?')) $app_uri = substr($app_uri, 0, $pos_get);
- This detects whether there's an actual '?' (GET standard format)
- If it's ok, that cuts our variable before the '?' which's reserved for getting datas
Considering $app_uri as the URI/URL of my website.