Re: When is an array not an array?
- From: "Andrew C" <nonsense@xxxxxxxxxxxxxxx>
- Date: Tue, 31 Oct 2006 06:46:17 GMT
"Andy Hassall" <andy@xxxxxxxxxxx> wrote in message
news:q13ck2d3tc2204gdsi3db9q0bds510pmsj@xxxxxxxxxx
On Mon, 30 Oct 2006 14:24:45 GMT, "Andrew C" <nonsense@xxxxxxxxxxxxxxx>
wrote:
I've encountered what seems to me to be something of an oddity while
playing
around with XML parsing in PHP, and I wondered if any of you might be able
to clear up my confusion...
Here's a little code:
$xmlDoc = new DOMDocument();
$xmlDoc->load('widget_data.xml');
$widgets = $xmlDoc->getElementsByTagName('widget');
My understanding was that '$widgets' is an array of elements,
Nope - it's a DOMNodeList object, that has support for PHP5 iterators, so
you
can use it in a foreach loop.
Thanks. That's my missing piece. I have quite a bit of experience of PHP
prior to 5, but I'm just feeling my way with some of the 5 stuff. :-)
A.
.
- References:
- When is an array not an array?
- From: Andrew C
- Re: When is an array not an array?
- From: Andy Hassall
- When is an array not an array?
- Prev by Date: Want to spawn process from Windows PHP
- Next by Date: Re: Bin packing problem
- Previous by thread: Re: When is an array not an array?
- Next by thread: Re: Speed :: XML vs. Database
- Index(es):
Relevant Pages
|