note 119818 added to class.splobjectstorage
| From: | frame86 at live dot com | Date: | Wed, 31 Aug 2016 20:29:57 +0000 |
| Subject: | note 119818 added to class.splobjectstorage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206446@lists.php.net to get a copy of this message | ||
Keep in mind that foreach() will copy your array before iterating, SplObjectStorage does not. If you
have a sub call within an iteration that also calls foreach() on the object storage again, the
iterator position collides!
To be safe use:
<?php
foreach(clone $myStorage as $obj) {
}
?>
----
Server IP: 212.124.37.9
Probable Submitter: 62.178.22.152
----
Manual Page -- http://php.net/manual/en/class.splobjectstorage.php
Edit -- https://master.php.net/note/edit/119818
Del: integrated -- https://master.php.net/note/delete/119818/integrated
Del: useless -- https://master.php.net/note/delete/119818/useless
Del: bad code -- https://master.php.net/note/delete/119818/bad+code
Del: spam -- https://master.php.net/note/delete/119818/spam
Del: non-english -- https://master.php.net/note/delete/119818/non-english
Del: in docs -- https://master.php.net/note/delete/119818/in+docs
Del: other reasons-- https://master.php.net/note/delete/119818
Reject -- https://master.php.net/note/reject/119818
Search -- https://master.php.net/manage/user-notes.php