php - Select files which name starts with some text -



php - Select files which name starts with some text -

how select list of files name starting "sometext_". have tried reading files , checking names string function. there improve way this?

answer :

$files = glob("files/sometext_*.txt"); print_r($files);

use glob function , see illustration in documentation

just changed illustration in documentation need

here code

foreach (glob("sometext_*") $filename) { echo "$filename size " . filesize($filename) . "\n"; }

php file

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -