View Single Post
Old 06-03-2010, 11:30 AM   #4 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

We could also use PHP's SPL objects, namely the DirectoryIterator, which as the name suggests, does just that!
PHP Code:
    try
    {
        foreach ( new 
DirectoryIterator('.') as $pItem )
        {
            if(
$pItem->isFile() || $pItem->isDot()) { continue; }
            echo 
$pItem '<br />';
        }
    }
    catch(
Exception $e)
    {
        echo 
$e->getMessage();
    } 
Yea the documentation isn't the greatest in for the SPL stuff, its a shame coz most of it is hot stuff!
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote