Page 1 of 1

Glob - Count the files

Posted: Fri Apr 28, 2006 10:47 am
by ozzy
Hey, i think im in love with glob, it works with so many things. But i ahve a question, how would i count the files which have been displayed through glob.

I tryed

Code: Select all

$numberoffiles = count(glob("$files"));
or

Code: Select all

$numberoffiles = count(glob("$path"));
But it didnt seem to work, and the output is 1111111111 or 0000000000. Does anyone know why or where im going wrong?

Thanks in advance! :)

LOVE YOU <3

Posted: Fri Apr 28, 2006 11:04 am
by feyd
That would depend on what $path and $files are. You have the correct syntax, if they are set correctly.

Posted: Fri Apr 28, 2006 12:10 pm
by ozzy
My current $files is:

Code: Select all

$files = glob($dir . 'vuns/files/*');

Posted: Fri Apr 28, 2006 12:20 pm
by feyd
just count($files) would work then.

Posted: Fri Apr 28, 2006 12:51 pm
by ozzy
But then it returns as just the number '0', dispite me having over 100 files.