File base name : File « File Directory « PHP






File base name

<?php
   $path = "./test.txt";
   $filename = basename($path); 
   $filename2 = basename($path, ".txt"); 
   
   echo $filename;
   
   echo "<BR>";
   
   echo $filename2;
?>


           
       








Related examples in the same category

1.dirname: get the directory name for a file
2.realpath: Returns canonicalized absolute pathname