realpathParent.php
Table of Contents
Functions
- realpathParent() : string
- Resolves a path's parent and leaves its last segment as it stands.
Functions
realpathParent()
Resolves a path's parent and leaves its last segment as it stands.
realpathParent(string $path) : string
realpath() answers for the whole path, which is too much when the last segment is the thing
being judged: a symbolic link would be replaced by what it points at, and a path that does not
exist would answer false. This resolves everything above the last segment — so a linked
ancestor cannot hide where a path really leads — and keeps the last segment verbatim.
When the parent cannot be resolved, because it does not exist, the path is canonicalized lexically instead: there is nothing on disk to ask.
Parameters
- $path : string
-
The path to resolve.
Tags
Return values
string —The path with its parent resolved and its last segment untouched.