This is a discussion on key => value iterations within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I am trying to print out values of key=> value pairs as: foreach ( $result as $key => $value ) echo(&...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am trying to print out values of key=> value pairs as:
foreach ( $result as $key => $value ) echo(" $key is $value \n"); This works fine unless I get and anwser something like: Contacts is Array How then, if one of the $values is an array, could I rewrite this to iterate down through such an array, echoing the values the same way? TIA, Ike |
|
|||
|
array_walk_recursive() may be what you're looking for:
http://ca.php.net/manual/en/function...-recursive.php Dae "Ike" <rxv@hotmail.com> wrote in message news:jxEle.681$s64.197@newsread1.news.pas.earthlin k.net... >I am trying to print out values of key=> value pairs as: > > foreach ( $result as $key => $value ) > echo(" $key is $value \n"); > > This works fine unless I get and anwser something like: > > Contacts is Array > > How then, if one of the $values is an array, could I rewrite this to > iterate > down through such an array, echoing the values the same way? TIA, Ike > > |