timmah1 Posted December 15, 2006 Share Posted December 15, 2006 Simple questionHow do I count and display how many items are in a folder? Link to comment https://forums.phpfreaks.com/topic/30755-item-count/ Share on other sites More sharing options...
obsidian Posted December 15, 2006 Share Posted December 15, 2006 Consider this modification to the manual example for opendir():[code]<?php$dir = "/etc/php5/";// Open a known directory, and proceed to read its contents$count = 0;if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { ++$count; } closedir($dh); }}echo "$count items found!";?> [/code] Link to comment https://forums.phpfreaks.com/topic/30755-item-count/#findComment-141752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.