If knowledge is power, then sharing knowledge is ultimate powertrip
Latest Updates
You are here: Home >> PHP >> count files in a folder using php

count files in a folder using php

Hi all,

We can count files in a folder using PHP by using the following function. It return the no of files in the directory provided as input argument

function count_files ($dir){

$count = count(glob($_SERVER[‘DOCUMENT_ROOT’].$dir . “*”)) ;

return $count;

}

Thanks

Jawed

About Jawed Shamshedi

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Scroll To Top