PHP/File Directory/pathinfo
Getting path components and file extensions
<?php
$info = pathinfo("/usr/local/php/php.ini");
echo $info["dirname"];
echo $info["basename"];
echo $info["extension"];
?>
pathinfo.php
<?php
$pathinfo = pathinfo("data.txt");
echo "Dir name: $pathinfo[dirname]<br />\n";
echo "Base name: $pathinfo[basename] <br />\n";
echo "Extension: $pathinfo[extension] <br />\n";
?>