← All built-ins / realpath()

realpath()

realpath(string $s): mixed

Parameters

NameTypeDescription
$pathstringpossibly relative path

Return value

Canonical absolute path, or false when it does not exist.

Example

$r = realpath("tests");
echo $r !== false && is_dir($r) ? "resolved" : "missing";
resolved

See also

dirname()getcwd()is_dir()