Req #51645 [Com]: array_walk for DOMNodeList
| From: | emm980 at windowslive dot com | Date: | Tue, 27 Apr 2010 14:41:43 +0000 |
| Subject: | Req #51645 [Com]: array_walk for DOMNodeList | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149963@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51645&edit=1
ID: 51645
Comment by: emm980 at windowslive dot com
Reported by: emm980 at windowslive dot com
Summary: array_walk for DOMNodeList
Status: Bogus
Type: Feature/Change Request
Package: Class/Object related
Operating System: Win 7
PHP Version: 5.3.2
New Comment:
"foreach: ... This simply gives an easy way to iterate over arrays.
foreach works only on arrays, and will issue an error when you try to
use it on a variable with a different data type..." PHP Manual
That doesn't mean it's not a good idea to make it work.
Other ways of iterating through a node list are the usual loops. But as
I've clearly stated, they are slow, when array_walk is faster. That's
the whole point of my request.
Previous Comments:
------------------------------------------------------------------------
[2010-04-23 12:45:26] rrichards@php.net
Just because its iterable does not mean its an array. There are other
ways to
access it than foreach.
------------------------------------------------------------------------
[2010-04-23 12:17:17] emm980 at windowslive dot com
Description:
------------
An updated array_walk for DOMNodeList objects.
Since these objects can be used in a foreach loop just like ordinary
arrays it would be nice and a way to improve performance if it were to
be possible to use then with a walker function. On the windows platform
at least, array_walk is significantly faster than foreach, especially in
situation where the arrays have thousands of elements or more, which I
suppose is its intended use.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51645&edit=1