This script takes any uri or segment from the url of the current page and assigns it to a $uri variable. It is very easy to implement so enjoy.
$uri = $_SERVER['REQUEST_URI'];
$pieces = explode("/", $uri);
$uri_3 = $pieces;
URI -Term used to collectively refer to URLs, URNs, and URCs.
$_SERVER is an array containing information such as headers, paths, and script locations. http://php.net/manual/en/reserved.variables.server.php
explode() Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter. http://php.net/manual/en/function.explode.php