note 89923 deleted from control-structures.foreach by danbrown
| From: | danbrown@php.net | Date: | Fri, 24 Jul 2009 15:52:40 +0000 |
| Subject: | note 89923 deleted from control-structures.foreach by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158699@lists.php.net to get a copy of this message | ||
Note Submitter: Kjetil Hrtveit
----
Appearently numerical keys are casted to int when looping with foreach.
Example:
<?php
$arr = array('10'=>'lol');
foreach ($arr as $k=>$v) {
var_dump($k);
}
?>
Output: int(10).
This came unexpected to me.