AV1611 Posted March 16, 2009 Share Posted March 16, 2009 How can I count the number of .jpg files (exact extension, not .jpeg for example) in the current directory (i.e. the directory in which the php script is located)? Thanks. Quote Link to comment Share on other sites More sharing options...
Zhadus Posted March 16, 2009 Share Posted March 16, 2009 Use scandir() and check the .jpg in the filename from the array it retrieves. Quote Link to comment Share on other sites More sharing options...
trq Posted March 16, 2009 Share Posted March 16, 2009 echo count(glob("*.jpg")); Quote Link to comment Share on other sites More sharing options...
AV1611 Posted March 16, 2009 Author Share Posted March 16, 2009 I was trying to figure how to do what Zhadus suggested but couldn't figure it out, but Thorpe, your answer is much better in this case, As always, you are my hero Thorpe! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.