Click to See Complete Forum and Search --> : Help needed - files.


Webfreak
03-18-2004, 10:20 AM
Hi!
I have this script to read files in folder: <?php


$dir = "../myfolder";
$handle = opendir($dir);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$files = $file."<br>";
}
}
closedir($handle); ?>

So it print files like this:

File1.php
File2.php
File3.php
....

Now i want to add this file into an array. How do i do this?

pyro
03-18-2004, 10:50 AM
Change$files = $file."<br>"; to $files[] = $file;$files will now be an array of the files.

Webfreak
03-18-2004, 10:52 AM
Thx :rolleyes:

pyro
03-18-2004, 10:54 AM
No problem.