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
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
...
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
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
[] = $file;
}
#vardump ($pictures[]);
?
alex
-Original Message-
From: Paul Furman [mailto:[EMAIL PROTECTED]
Sent: Friday, February 06, 2004 1:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] beginner question about while loops
Totally ignorant need for clarification... Should I set
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
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
:[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
- 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]
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
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;
11 matches
Mail list logo