You are here: Re: When is an array not an array? « PHP Programming Language « IT news, forums, messages
Re: When is an array not an array?

Posted by Andrew C on 10/31/06 06:46

"Andy Hassall" <andy@andyh.co.uk> wrote in message
news:q13ck2d3tc2204gdsi3db9q0bds510pmsj@4ax.com...
> On Mon, 30 Oct 2006 14:24:45 GMT, "Andrew C" <nonsense@totally.made.up>
> 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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация