note 16969 deleted from control-structures.foreach by sniper
| From: | sniper@php.net | Date: | Wed, 08 Oct 2003 04:10:55 +0000 |
| Subject: | note 16969 deleted from control-structures.foreach by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58016@lists.php.net to get a copy of this message | ||
Note Submitter: basil.hussain@kodakweddings.com
----
There is some undocumented behaviour with foreach() to do with objects. If you use the following
code:
foreach($myarray as $x->y) {
...
}
On each iteration, $x will be created as an object (of class 'stdClass') with the property
y containing the value of the current array element.
This could catch you out if you type "->" instead of "=>", so beware!