- var_dump: documentation ( source)
- basename: documentation ( source)
- dirname: documentation ( source)
- array_unshift: documentation ( source)
<?php
function path_components($path)
{
$components = array();
while ($path != "" && $path != "/")
{
array_unshift($components, basename($path));
$path = dirname($path);
}
return $components;
}
var_dump(dirname("/"));