#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,660
    Rep Power
    171

    About readin files in a directory


    Solution A works fine. But howcome B doesn't?
    PHP Code:
    ### A
    $handle='';
    $handle opendir('.');
    while(
    false !==($file readdir($handle)))
        {
            echo 
    $file."------".filesize($file)." bytes<br />";
        }
        
    ### B    
    //  Still wondering why can't just write:
    while($file readdir($handle))
        {
            echo 
    $file."------".filesize($file)." bytes<br />";
        } 
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    If you have a file named 0 then the second statement will evaluate to false and your loop will end.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo