What function can be used in PHP to remove the last directory name from a path string?

To remove the last directory name from a path string in PHP, you can use the `dirname()` function. This function returns the parent directory's path of a specified path. By calling `dirname()` twice on the original path, you can effectively remove the last directory name.

$path = "/path/to/your/directory";
$parentDir = dirname(dirname($path));
echo $parentDir;