beginner question about while loops
| From: | Paul Furman | Date: | Fri, 06 Feb 2004 19:41:25 +0000 |
| Subject: | beginner question about while loops | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-177038@lists.php.net to get a copy of this message | ||
Totally ignorant need for clarification... Should I set up a counter for loops $integer++ or if I'm going through something, the while function knows to just go through those and fills in array numbers accordingly?
Below is my project (while loop at the bottom):
I'm getting unexpected $end on line 18 but the file only has 17 lines!
<?php
if (isset ($_REQUEST ['IMGDIR'])){
$imagedir=$_REQUEST ['IMG_DIR'];
} else {
$imagedir = PUB_DIR . '/grasses';
#PUB_DIR coordinates my public htm location at home & school
}
if (!(chdir ($imagedir))){
print "invalid directory";
}
$fh=opendir($imagedir);
while ($file = readdir($dh)){
if (strstr ($file, '.jpg')){
$pictures[] = $file;
}
#vardump ($pictures[]);
?>