Understanding $_PATH

Array
(
    [0] => 2
    [1] => docs
    [2] => paths
)

$_PATH is something I did some time ago as my answer to getting and parsing urls for use with mod-rewrite. It's pretty self explanatory once you know the finer points of how it works. Some of those points are:

  1. $_PATH[0] always displays the number of segments in a url. If the url is /one/very/segmeneted/url, $_PATH[0] will be 4. $_PATH[0] is always set.
  2. $_PATH[1] is the first segment of the URL, on this page it is "docs". If $_PATH[0] is set as 0, $_PATH[1] is not set.

Still foncused?

You can ask any question about $_PATH you like here »