Break the string into an array with explode, and then take the part you need.
$whatINeed = explode('/', $_SERVER['REQUEST_URI']);
$whatINeed = $whatINeed[1];
If you are using PHP 5.4, you can do $whatINeed = explode('/', $_SERVER['REQUEST_URI'])[1];
source
share