Re: beginner question about while loops
| From: | John W. Holmes | Date: | Fri, 06 Feb 2004 20:57:10 +0000 |
| Subject: | Re: beginner question about while loops | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177046@lists.php.net to get a copy of this message | ||
From: "Paul Furman" <paul@edgehill.net>
> So when assigning values to an array inside a loop, it knows to advance
> to the next but then if I want to print those out at the same time, it's
> complaining
>
> while ($file = readdir($fh)){
> if (strstr ($file, '.jpg')){
> $pictures[] = $file;
> #print $pictures[]; #Fatal error: Cannot use [] for reading
> }
> var_dump ($pictures[]); #Fatal error: Cannot use [] for reading
> }
Can't do that, like it says. You just assigned $file to $print.. so just
display the value of $file.
---John Holmes...