dirname
dirname() is the name of the path to a file.
In the path /var/www/index.php, the dirname is /var/www.
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.
See Also
- Understanding the PHP’s pathinfo() Function
- Get the directory name and filename from a full path name with PHP