php - use glob() function to find files starting with variable ← (PHP)

I am a bit of newbie to coding. I am looking to count the number of files in my directory that start with a string variable. I don't know how to format a glob condition yet. I did some research but i am still lost. I want my string $files = glob($directory . "-$TaxonID*.jpg"); to search through the files and count how many begin with the variable TaxonID. But I don't know how to format such a condition. I am using a PHP query here. Any help appreciated

Answer



Solution:

Apologies for bothering you I have figured it out$files = glob($directory . "$TaxonID*.jpg"); it seemed to work very well. as in the first part of the file must equal taxonID then it can be whatever (asterix) but it must end in .jpg thank you for your help guys, just had to do more research myself

Source