Re: When is an array not an array?




Does anyone have an explanation as to why a DOMNodeList can be accessed like
an array using 'foreach', but won't allow square-brackets to be used? What
exactly *is* a DOMNodeList?

A DOMNodeList is an object - this is why you can't access items using
square-brackets.
Since PHP5 you can iterate through all visible properties of an object
- this is why you can access items using a foreach statement.

.