Re: When is an array not an array?




"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.


.



Relevant Pages

  • Re: Sunday Afternoon Smoke.....
    ... "Roundabout" is playing right now. ... Working on an endless programming project. ... I'm working in JavaScript right now, but thinking of tackling it in PHP, which will be a problem, as I know about as much PHP as I know Greek, the two being quite similar. ...
    (alt.smokers.pipes)
  • Re: fpassthru and mp3 player
    ... >>>songs stop playing when after a while... ... >> give or take a buffer size, it'll exceed PHP's maximum execution time, and PHP ... Turn on log_errors in PHP in case it's producing a PHP error at the end - you ... You could use something like Ethereal to packet-sniff the transfer, ...
    (comp.lang.php)
  • Where are the web 2.0 .netters?
    ... With all the web 2.0 hype out there, I'm finding that .net isn't playing ... Nearly everything out there getting publicity is PHP or ROR ...
    (microsoft.public.dotnet.framework.aspnet)
  • No errors being returned
    ... I'm playing around with phpOpenTracker Since the example files generate ... a blank screen (and no HTML source) on my system, I'm trying to get PHP ...
    (comp.lang.php)
  • More help needed
    ... I wish to include a txt file in to a php page,it's ... a list of CDs.I have been playing with (see code ... Never argue with an idiot. ... They will drag you down to their level,and beat you with experience ...
    (alt.php)