Jay Blanchard wrote:
> [snip]
> Can PHP generate an array based on file names in a folder?
>
> For example, if I have a folder called "photos" that includes three
> files -- tree.jpg, house.jpg and boat.jpg -- can PHP "look" at the file
> and generate a variable $photos= array ("tree", "house","boat"). Any
> ideas for how to "sniff" out a folder to determine how many files are in
> it and then create an array with the file names in it?
> [/snip]
>
> Start with http://www.php.net/readdir
Yep.
<?php
$dp = fopen('/path/to/dir', 'r');
while(false !== $files[] = readdir($dp)) {}
closedir($dp);
$str = implode('', $files);
var_dump($str);
?>
signature.asc
Description: OpenPGP digital signature

