ted_chou12 Posted December 13, 2006 Share Posted December 13, 2006 say for example, I want to know how much txt files there are in my folder, is there a php function for that?Thankyou! :D Link to comment https://forums.phpfreaks.com/topic/30549-how-do-you-count-the-number-of-a-specific-type-of-files-in-a-dir/ Share on other sites More sharing options...
kenrbnsn Posted December 13, 2006 Share Posted December 13, 2006 Use the [url=http://www.php.net/glob]glob()[/url] function which puts the files into an array, then get the count of the number of entries in the array.Ken Link to comment https://forums.phpfreaks.com/topic/30549-how-do-you-count-the-number-of-a-specific-type-of-files-in-a-dir/#findComment-140635 Share on other sites More sharing options...
ted_chou12 Posted December 13, 2006 Author Share Posted December 13, 2006 thanks Link to comment https://forums.phpfreaks.com/topic/30549-how-do-you-count-the-number-of-a-specific-type-of-files-in-a-dir/#findComment-140639 Share on other sites More sharing options...
ted_chou12 Posted December 16, 2006 Author Share Posted December 16, 2006 okay, ive got this far:[code]<?php foreach (glob("*.txt") as $filename)?>[/code], however, how do you count the number of files in the array? Link to comment https://forums.phpfreaks.com/topic/30549-how-do-you-count-the-number-of-a-specific-type-of-files-in-a-dir/#findComment-142312 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.