Get the current file name, current directory, and upper directory
File name test.php
Path + file name (to get /var/www/test/test.php)
echo __FILE__;
File name (to get test.php)
echo basename(__FILE__);
File name without extension (to get test)
echo basename(__FILE__, '.php');
Complete PATH to this directory, excluding file names (to obtain /var/www/test)
echo dirname(__FILE__);
The upper directory PATH of the current file (to obtain /var/www)
echo dirname(dirname(__FILE__));