\n"; if (substr_count($path, $root) < 1) //check $root is actually part of the path of this current page { echo "The root folder doesn't exist in this path. FAIL!
\n"; return -1; } $path = substr($path, stripos($path, $root)); //strip out everything before the declared root echo "Rooted path: ".$path."
\n"; $homedpath = substr_replace($path, $homedispname, 0, strlen($root)); //replace root folder name with 'Home' echo "Homed path: ".$homedpath."
\n"; $folders = explode("/", $homedpath); echo "Breadcrumbs: ".$folders."
\n"; if ($folders) { return $folders; } else { return $homedispname; } } catch (Exception $e) { echo $e; } } /** * This function returns an array of relative paths, for the anchors of the breadcrumbs. * @param root The first folder, root of the relative paths. * @return folderpaths An array of relative paths */ function getFolderpathArray($root="intranet-new") { $path = getcwd(); return $path; } ?> Test!!

Testing getFolderpathArray

Without a root specified:

Specifying scripts folder as root:

Testing getFoldernameArray

Without a root specified:

Specifying scripts folder as root only:

Specifying scripts folder as root and Script Home as homedispname:

Specifying Script Home as homedispname only: