Re: array from folder

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 25 April 2005 20:24, Ed Dorsch wrote:
> 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?

Have you tried the Iterator API functionality? It's part of the SPL extension 
and I'm pretty sure it'll help you unless you don't use PHP 5.

Check it, it's very feasible and handy:

http://www.php.net/~helly/php/ext/spl/annotated.html

>
> Thanks,
> Ed
>
> Ed Dorsch
> Development Communications
> University of Oregon
> 541.346-0605 <?xml:namespace prefix = o ns =
> "urn:schemas-microsoft-com:office:office" />
>
> "You can't wait for inspiration. You have to go after it with a club."
>  -Jack London

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: pgpm6SSNpMcQv.pgp
Description: PGP signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux