php - Select files which name starts with some text -


To select a list of files that started with "sometext_" I read all the files and the string function Tried to check their names together. Is there a better way to do this?

The answer is:

  $ files = glob ("file / some time ago * * .txt"); Print_r ($ files); Use    

function and see example in document

For example, the document is

as your requirement

  foreach (globe ("sometext_ *") as $ filename) {echo "$ filename size "Filesystem ($ filename). "\ N"; }  

Comments