note 51074 deleted from control-structures.foreach by danbrown
| From: | danbrown@php.net | Date: | Tue, 28 Apr 2009 13:11:09 +0000 |
| Subject: | note 51074 deleted from control-structures.foreach by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153926@lists.php.net to get a copy of this message | ||
Note Submitter:
----
It seems that foreach returns different variable types depending on which syntax you use and which
version of PHP you are running.
If you use this syntax:
foreach($array as $key => $val) {
then the $val variable is a string (or whatever the actual value in the array is).
But if you use this syntax:
foreach($array as $val) {
then it appears that the $val variable is an array in PHP 4.3.10, and it is a string (or whatever)
in versions 4.3.1, 4.3.2, and 4.3.6 (I haven't tested any other version).