Wie können relative und absolute Pfade in PHP effektiv normalisiert werden, um eine eindeutige Repräsentation zu erreichen?

Relative and absolute paths in PHP can be effectively normalized using the realpath() function. This function resolves any symbolic links and references to the actual path, providing a unique representation of the file or directory location.

$relativePath = "folder/../file.txt";
$absolutePath = realpath($relativePath);

echo $absolutePath;