Re: [PHP] flaking out on foreach
Bad code. Take the ';' off the end of the foreach... ROBERT MCPEAK wrote: >Why is this code: > > > $bob=array(1,2,3,5,6); > > foreach($bob as $foo); > { > echo "$foo"; > } > ?> > >Rendering only "6". That's it. Just "6". What am I missing here? > > > -- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] flaking out on foreach
Don't put a semicolon after the foreach. Adam Voigt [EMAIL PROTECTED] On Tue, 2002-08-27 at 11:07, ROBERT MCPEAK wrote: > Why is this code: > > > $bob=array(1,2,3,5,6); > > foreach($bob as $foo); > { > echo "$foo"; > } > ?> > > Rendering only "6". That's it. Just "6". What am I missing here? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] flaking out on foreach
> From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, August 27, 2002 11:08 AM > Subject: [PHP] flaking out on foreach > > > Why is this code: > > > $bob=array(1,2,3,5,6); > > foreach($bob as $foo); ^^^ Because of the empty statement caused by the mistaken semi-colon here > { > echo "$foo"; > } > ?> > > Rendering only "6". That's it. Just "6". What am I missing here? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] flaking out on foreach
Why is this code: "; } ?> Rendering only "6". That's it. Just "6". What am I missing here? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php