dirname

Dirname is the name of the path to a file.

In /var/www/index.php, the dirname is /var/www.

In PHP, dirname() provides the dirname from a path, based on the / separator. It has to be combined with basename() to get the name of the directory, without its path.

Documentation