I'm having an issue with grabbing the last part of the URL before the query parameters.
The current solution I'm using is this:
$base_url = current_url();
$uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri_segments = explode('/', $uri_path);
$language = $uri_segments[1];
$end_url = array_pop($uri_segments);
I then pass the $end_url through a Switch statement to modify form fields, depending on the value.
Is there something I'm missing or is there a more efficient way to grab the last part of the URL?
Any suggestions would be helpful and greatly appreciated.
Thanks!