Re: [PHP] question about foreach and associate array

2006-02-21 Thread Richard Lynch
On Mon, February 20, 2006 8:57 pm, jonathan wrote: > I have the following construct: > > $arg['textarea']['body']="Hello"; > > >foreach($arg['textarea'] as $row) >{ > echo $row['body'].""; > echo $arg['textarea']['body'].""; > >} > > I would expect bo

Re: [PHP] question about foreach and associate array

2006-02-21 Thread Jochem Maas
jonathan wrote: I have the following construct: $arg['textarea']['body']="Hello"; foreach($arg['textarea'] as $row) { echo $row['body'].""; $row contains the _string_ 'Hello'. the thing is you can use array-like notation to get at the individual chars of a string.

RE: [PHP] question about foreach and associate array

2006-02-20 Thread Peter Lauri
Just do: $arg['textarea']['body']="Hello"; foreach($arg['textarea'] as $row) { echo $row.""; echo $arg['textarea']['body'].""; } The $row is an string, and what you are trying to do the $row['body']. And php will translate 'body' to 0 in this, I do not know why :) Try echo $row['bod

Re: [PHP] question about foreach and associate array

2006-02-20 Thread Chris
jonathan wrote: I have the following construct: $arg['textarea']['body']="Hello"; foreach($arg['textarea'] as $row) { echo $row['body'].""; echo $arg['textarea']['body'].""; } I would expect both of them to output "Hello" but only the second does