|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-21 07:03 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 09:00:02 2025 UTC |
Description: ------------ Iteration through a large ArrayObject (e.g. 10,000+ items) is very slow. Reproduce code: --------------- $a = new ArrayObject; for ($i = 0; $i < 10000; $i++) $a[] = $i; // This is slow foreach ($a as $k => $v); // This is much faster, even though I thought this was basically what ArrayObject's getIterator method did. $it = new ArrayIterator($a->getArrayCopy()); foreach ($it as $k => $v);