Skip to content

cr8tpro/CurrentDirectory_PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Language: PHP
Description:

Write a function that provides change directory (cd) function for an abstract file system.

Notes:
root path is '/'.
path separator is '/'.
parent directory is addressable as '..'.
directory names consist only of English alphabet letters (A-Z and a-z).
the function will not be passed any invalid paths.
not use built-in path-related functions.

For example:
$path = new Path('/a/b/c/d');
$path->cd('../x');
echo $path->currentPath;
should display '/a/b/c/x'.

$path->cd('./x');
should display '/a/b/c/d/x'.

$path->cd('x');
should display '/a/b/c/d/x'.

$path->cd('/a');
should display '/a'.

$path->cd('../../e/../f');
should display '/a/b/f'.

$path->cd('/d/e/../a');
should display '/d/a'.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages