R3m/framework Function reference dir.name

{dir.name(String $url, Int $levels=1)}

{dir.name()} — Returns a parent directory's path
Given a string containing the path of a file or directory, this function will return the parent directory's path that is levels up from the current directory.


{dir.name()} operates naively on the input string, and is not aware of the actual filesystem, or path components such as "..".

Returns the path of a parent directory as a string.
If there are no slashes in path, an empty string is returned.
Otherwise, the returned string is path with a trailing /component.

Last modified: 2021-06-07

© 2021 universeorange.com