How to count number of files in directory PHP?By Hardik Savani | March 14, 2016 | | 1357 Viewer | Category : PHP
Share this post:
If you are working on code php and you require to count number of files, images, zip file, rar files, etc in the given folder path, then you can count using glob() and count() of php. So, let's see this bellow example and learn how it done.
$folderPath = "upload/";
$countFile = 0;
$totalFiles = glob($folderPath . "*");
$countFile = count($totalFiles);
- PHP download file from url using curl example
- Laravel 5.3 new feature and update - $loop variable
- laravel 5.4 New Feature - Add eloquent whereKey method
- How to confige Elasticsearch in our local system
- How to retrieve number of twitter followers count without authentication or api ?
- Laravel 5 select with count query with group by example
- Laravel 5 Join with subquery in Query Builder Example
- Mailgun setup with Laravel 5 example