I am writing one function for getting some different database query. Now things are going well but only need to get last directory name from defined path.
$q
This gives you the current directory name: echo basename(dirname(__FILE__));
echo basename(dirname(__FILE__));