File Count in PHP

Soldato
Joined
27 Dec 2005
Posts
17,316
Location
Bristol
Hi guys. I'm looking for a way of counting the number of files in a certain folder OR with a certain wildcard name (ie. ImageGroup1-0xx.jpg) with PHP.

Thanks for any help in advance :)
 
glob() reads all the files in a specified folder into an array. as you can see, it supports wildcards.

PHP:
$count = count(glob('images/*.jpg'));

then use count() to count how many elements are in the array.
 
Back
Top Bottom