note 114509 rejected from class.arrayobject by googleguy

From: Date: Sun, 02 Mar 2014 01:51:12 +0000
Subject: note 114509 rejected from class.arrayobject by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198756@lists.php.net to get a copy of this message
Note Submitter: spidgorny at gmail dot com ---- Beware that foreach($arrayObject) will skip NULL keys! Test: <?php $o = new ArrayObject(array(NULL => 'NULL', 1, 2)); foreach ($o as $key => $i) { echo $key, '=', $i, "\n"; } foreach ((array)$o as $key => $i) { echo $key, '=', $i, "\n"; } ?> I have expected the output to match, but this is what I get: 0=1 1=2 =NULL 0=1 1=2 Notice that NULL key is missing.

« previous php.notes (#198756) next »