Re: [PHP] beginner question about while loops

2004-02-09 Thread Jochem Maas
Paul, the warning that John refers to does occur - whether you see it depends on the error reporting level, PHP will create the array for you if you have not already initialized it but a warning will be generated in such cases. - errors that may not display on one machine might be visible

Re: [PHP] beginner question about while loops

2004-02-09 Thread Paul Furman
Jochem Maas wrote: Paul, the warning that John refers to does occur - whether you see it depends on the error reporting level, PHP will create the array for you if you have not already initialized it but a warning will be generated in such cases. ... error_reporting = E_ALL ...

Re: [PHP] beginner question about while loops

2004-02-06 Thread Eric Gorr
At 11:41 AM -0800 2/6/04, Paul Furman wrote: while ($file = readdir($dh)){ if (strstr ($file, '.jpg')){ $pictures[] = $file; } Spotted this problem when staring at your code. Number of open braces: 2 Number of close braces: 1 You need to close off your while loop. Should I

RE: [PHP] beginner question about while loops

2004-02-06 Thread Alex Hogan
You didn't close your loop; while ($file = readdir($dh)){ if (strstr ($file, '.jpg')){ $pictures[] = $file; } #vardump ($pictures[]); } = here ? instead of; while ($file = readdir($dh)){ if (strstr ($file, '.jpg')){ $pictures[] =

Re: [PHP] beginner question about while loops

2004-02-06 Thread Paul Furman
Eric Gorr wrote: the while function knows to just go through those and fills in array numbers accordingly? The while function has nothing to do with it. Using the syntax $array[] simply adds an element onto the _end_ of the array and PHP picks the next logical, numerical index. OK thanks

Re: [PHP] beginner question about while loops

2004-02-06 Thread Rob Adams
Paul Furman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Eric Gorr wrote: [snip] while ($file = readdir($fh)){ if (strstr ($file, '.jpg')){ $pictures[] = $file; #print $pictures[]; #Fatal error: Cannot use [] for reading Which element are you trying

RE: [PHP] beginner question about while loops

2004-02-06 Thread Shaunak Kashyap
:[EMAIL PROTECTED] Sent: Friday, February 06, 2004 3:09 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] beginner question about while loops Eric Gorr wrote: the while function knows to just go through those and fills in array numbers accordingly? The while function has nothing to do

Re: [PHP] beginner question about while loops

2004-02-06 Thread John W. Holmes
- Original Message - From: Paul Furman [EMAIL PROTECTED] 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? [snip]

Re: [PHP] beginner question about while loops

2004-02-06 Thread Paul Furman
OK thanks again for helping through the stumbling blocks... I'm rolling again now. John W. Holmes wrote: Just make sure $pictures is defined as an array before you try to push a value onto it (even using the method you have now), otherwise you'll get a warning. It seems to be working fine this

Re: [PHP] beginner question about while loops

2004-02-06 Thread John W. Holmes
From: Paul Furman [EMAIL PROTECTED] 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;