Simple XML array count??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm using SimpleXML to go through a Google search result and I'm not quite
understanding something.  The variable $xml->RES->R is an array of 9 items
and each item is an object containing information (see var dump below).  So
when I try to do count($xml->RES->R); it returns a number or 1 instead a
number of 10.  Also, when I do a print_r($xml->RES->R); all I get is a dump
of $xml->RES->R[0] and not the rest of the array.  I'm not quite sure what
is going on?  I'm using PHP 5.0.4 maybe there's a bug?

SimpleXMLElement Object
(
    [TM] => 0.081574
    [Q] => benefits
    [PARAM] => Array
        (
            [0] => SimpleXMLElement Object
                (
                )

            [1] => SimpleXMLElement Object
                (
                )

            [2] => SimpleXMLElement Object
                (
                )

            [3] => SimpleXMLElement Object
                (
                )

            [4] => SimpleXMLElement Object
                (
                )

            [5] => SimpleXMLElement Object
                (
                )

            [6] => SimpleXMLElement Object
                (
                )

            [7] => SimpleXMLElement Object
                (
                )

            [8] => SimpleXMLElement Object
                (
                )

        )

    [RES] => SimpleXMLElement Object
        (
            [M] => 1830
            [FI] => SimpleXMLElement Object
                (
                )

            [NB] => SimpleXMLElement Object
                (
                    [NU] =>
/search?q=benefits&site=default_collection&hl=en&lr=&ie=UTF-8&output=xml_no_
dtd&client=default_frontend&access=p&sort=date:D:L:d1&start=10&sa=N
                )

            [R] => Array
                (
                    [0] => SimpleXMLElement Object
                        (
                            [U] => http://benefits/
                            [UD] => http://benefits/
                            [UE] => http://benefits/
                            [T] => <b>Benefits</b>
                            [RK] => 10
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => Home, <b>Benefits</b> Forms Jobs Training
Locations, Who We Are E-Info Publications EVA<br> Team Websites. <b>...</b>
2006 <b>Benefits</b> Vote. <b>Benefits</b> Links. <b>Benefits</b> Websites.
<b>...</b>  
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [1] => SimpleXMLElement Object
                        (
                            [U] => http://benefits/benefits_websites.html
                            [UD] => http://benefits/benefits_websites.html
                            [UE] => http://benefits/benefits_websites.html
                            [T] => <b>Benefits</b>

                            [RK] => 9
                            [CRAWLDATE] =>  17 May 2006
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => Home, <b>Benefits</b> Forms Jobs Training
Locations, Who We Are E-Info Publications<br> EVA Team Websites.
<b>Benefits</b> Websites.  <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                            [HN] => /benefits
                        )

                    [2] => SimpleXMLElement Object
                        (
                            [U] => http://www..com/jobs//benefits.html
                            [UD] => http://www..com/jobs//benefits.html
                            [UE] => http://www..com/jobs//benefits.html
                            [T] => Whole Foods : Jobs : North Atlantic
Region Career Opportunities
                            [RK] => 10
                            [CRAWLDATE] =>  15 May 2006
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => <b>...</b>  <b>Benefits</b> Summary.
<b>...</b> The <b>Benefits</b> of a Unique Culture. At<br>  <b>...</b>
success. Medical Care <b>Benefits</b>. Available after <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [3] => SimpleXMLElement Object
                        (
                            [U] => http://www..com/jobs/uk/benefits.html
                            [UD] => http://www..com/jobs/uk/benefits.html
                            [UE] => http://www..com/jobs/uk/benefits.html
                            [T] =>  : Jobs : United Kingdom Career
Opportunities
                            [RK] => 9
                            [CRAWLDATE] =>  15 May 2006
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => <b>...</b> <b>Benefits</b> Summary.
Current <b>benefits</b>:<br> Gain <b>...</b> of new <b>benefits</b>. The
<b>Benefits</b> of a Unique Culture. <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [4] => SimpleXMLElement Object
                        (
                            [U] => http://training/bene_guide.pdf
                            [UD] => http://training/bene_guide.pdf
                            [UE] => http:///training/bene_guide.pdf
                            [T] => 2004 <b>benefits</b> trainer guide
                            [RK] => 6
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => Page 1. <b>Benefits</b> Orientation
Trainer¹s Guide 2004 <b>...</b> 2 0 0 4 <b>BENEFITS</b> Orientation n<br>
Trainer ¹s Guide 4 <b>Benefits</b> Orientation WORKBOOK at n Updated 1.1.04
Page 5. <b>...</b> 
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [5] => SimpleXMLElement Object
                        (
                            [U] => http://training/mw_sta_benefits.ppt
                            [UD] => http://training/mw_sta_benefits.ppt
                            [UE] => http://training/mw_sta_benefits.ppt
                            [T] => Orientation Presentation
                            [RK] => 6
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => <b>...</b> 7-2, Oct 99. Basic
<b>Benefits</b>. Available to Everyone. Credit Union. <b>...</b>
<b>Benefits</b> Requiring<br> Team Membership. 7-4, Oct 99. <b>Benefits</b>
Requiring Team Membership. Â?continued <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                            [HN] => /training
                        )

                    [6] => SimpleXMLElement Object
                        (
                            [U] =>
http://publications/innerviews/benefits0305.html
                            [UD] =>
http://publications/innerviews/benefits0305.html
                            [UE] =>
http://publications/innerviews/benefits0305.html
                            [T] => Publications
                            [RK] => 5
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => YOUR <b>BENEFITS</b>. How&#39;s everyone
doing with their New Year&#39;s resolutions to<br> eat better, lose some
extra pounds or quit smoking?... Here <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [7] => SimpleXMLElement Object
                        (
                            [U] =>
http://publications/innerviews/benefits0204.html
                            [UD] =>
http://publications/innerviews/benefits0204.html
                            [UE] =>
http://publications/innerviews/benefits0204.html
                            [T] => Publications
                            [RK] => 4
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => <b>Benefits</b> News. National
<b>Benefits</b> &amp; Compensation Team Medical Card ID Numbers<br>
Beginning January 1, 2004, UnitedHealthcare (UHC) will <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                            [HN] => /publications/innerviews
                        )

                    [8] => SimpleXMLElement Object
                        (
                            [U] =>
http://www..com/cgi-bin/print10pt.cgi?url=/jobs//benefits.html
                            [UD] =>
http://www..com/cgi-bin/print10pt.cgi?url=/jobs//benefits.html
                            [UE] =>
http://www..com/cgi-bin/print10pt.cgi%3Furl%3D/jobs//benefits.html
                            [T] =>
www.wholefoodsmarket.com/jobs/northatlantic/<b>benefits</b>.html
                            [RK] => 4
                            [CRAWLDATE] =>  16 May 2006
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => <b>...</b> /<b>benefits</b>.html.
<b>Benefits</b> Summary. <b>...</b> The <b>Benefits</b> of<br> a Unique
Culture. <b>...</b> success. Medical Care <b>Benefits</b>. Available after
<b>...</b>  
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [9] => SimpleXMLElement Object
                        (
                            [U] =>
http://www..com/cgi-bin/print10pt.cgi?url=/jobs/uk/benefits.html
                            [UD] =>
http://www..com/cgi-bin/print10pt.cgi?url=/jobs/uk/benefits.html
                            [UE] =>
http://www..com/cgi-bin/print10pt.cgi%3Furl%3D/jobs/uk/benefits.html
                            [T] => www..com/jobs/uk/<b>benefits</b>.html
                            [RK] => 4
                            [CRAWLDATE] =>  16 May 2006
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => URL:
http://www..com/jobs/uk/<b>benefits</b>.html.  <b>Benefits</b> Summary.
<b>...</b> The <b>Benefits</b> of a Unique Culture. <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                            [HN] => www..com/cgi-bin/print10pt.cgi
                        )

                )

        )

)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux