0

How do I get only the file name instead of the path + file name?

foreach(glob('./item/*.txt') as $filename){
   echo $filename;
}
Becky
  • 5,217
  • 9
  • 33
  • 68

1 Answers1

1

Use basename($filename) to get the filename of the file. Check the documentation here: http://php.net/manual/en/function.basename.php

Lionel Chan
  • 7,744
  • 5
  • 37
  • 69