// use dirname to get the directory of the current file
$path = dirname(__FILE__);
// $path here is now /path_to/your_dir
// split directory into array of pieces
$pieces = explode(DIRECTORY_SEPARATOR, $path);
// $pieces = ['path_to', 'your_dir']
// get the last piece
echo $pieces[count($pieces) - 1];
// result is: your_dir