Re: dir to array?

From: Date: Wed, 31 Jul 2002 20:11:06 +0000
Subject: Re: dir to array?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110567@lists.php.net to get a copy of this message
On Thursday 01 August 2002 03:00, Jas wrote: > Not sure why this isn't working, any help is appreciated. I am trying to > read the files in a directory and place them into an array. Here is the > code: > > /* Function to create array of directory contents */ > function dCNTS($files) { > $dir = opendir("/path/to/directory/"); > while($imgs = readdir($dir)) { > if (($imgs != ".") && ($imgs != "..")) { > $cnt[count($imgs)] = $cnt; > } else { > print "Cannot create array of files in directory!"; } > } > closedir($dir); > } HOW isn't it working? -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* One person's error is another person's data. */

« previous php.general (#110567) next »