How to get value in SimpleXMLElement object?
<p>This (var_dump) is a XMLElement object  of Alexa rank of a website. All I want is to read the RANK value( which is 4 here). How to get it?
I'm trying to do:</p>

<p><strong>print (string) $xml->SD->REACH->RANK;</strong> //but not working out</p>

<pre><code>object(SimpleXMLElement)#1 (4) {
  ["@attributes"]=&gt;
  array(4) {
    ["VER"]=&gt;
    string(3) "0.9"
    ["URL"]=&gt;
    string(10) "yahoo.com/"
    ["HOME"]=&gt;
    string(1) "0"
    ["AID"]=&gt;
    string(1) "="
  }
  ["KEYWORDS"]=&gt;
  object(SimpleXMLElement)#2 (1) {
    ["KEYWORD"]=&gt;
    array(2) {
      [0]=&gt;
      object(SimpleXMLElement)#12 (1) {
        ["@attributes"]=&gt;
        array(1) {
          ["VAL"]=&gt;
          string(10) "On the Web"
        }
      }
      [1]=&gt;
      object(SimpleXMLElement)#4 (1) {
        ["@attributes"]=&gt;
        array(1) {
          ["VAL"]=&gt;
          string(11) "Web Portals"
        }
      }
    }
  }
  ["DMOZ"]=&gt;
  object(SimpleXMLElement)#14 (1) {
    ["SITE"]=&gt;
    object(SimpleXMLElement)#7 (2) {
      ["@attributes"]=&gt;
      array(3) {
        ["BASE"]=&gt;
        string(10) "yahoo.com/"
        ["TITLE"]=&gt;
        string(6) "Yahoo!"
        ["DESC"]=&gt;
        string(133) "A major internet portal and service provider offering search results, customizable content, chatrooms, free e-mail, clubs, and pager."
      }
      ["CATS"]=&gt;
      object(SimpleXMLElement)#8 (1) {
        ["CAT"]=&gt;
        array(3) {
          [0]=&gt;
          object(SimpleXMLElement)#11 (1) {
            ["@attributes"]=&gt;
            array(3) {
              ["ID"]=&gt;
              string(45) "Top/Computers/Internet/On_the_Web/Web_Portals"
              ["TITLE"]=&gt;
              string(22) "On the Web/Web Portals"
              ["CID"]=&gt;
              string(6) "375197"
            }
          }
          [1]=&gt;
          object(SimpleXMLElement)#10 (1) {
            ["@attributes"]=&gt;
            array(3) {
              ["ID"]=&gt;
              string(34) "Top/Computers/Companies/Yahoo_Inc."
              ["TITLE"]=&gt;
              string(20) "Companies/Yahoo Inc."
              ["CID"]=&gt;
              string(6) "376283"
            }
          }
          [2]=&gt;
          object(SimpleXMLElement)#9 (1) {
            ["@attributes"]=&gt;
            array(3) {
              ["ID"]=&gt;
              string(118) "Top/Regional/North_America/United_States/California/Localities/S/Sunnyvale/Business_and_Economy/Computers_and_Internet"
              ["TITLE"]=&gt;
              string(43) "Business and Economy/Computers and Internet"
              ["CID"]=&gt;
              string(6) "627776"
            }
          }
        }
      }
    }
  }
  ["SD"]=&gt;
  object(SimpleXMLElement)#13 (3) {
    ["POPULARITY"]=&gt;
    object(SimpleXMLElement)#3 (1) {
      ["@attributes"]=&gt;
      array(2) {
        ["URL"]=&gt;
        string(10) "yahoo.com/"
        ["TEXT"]=&gt;
        string(1) "4"
      }
    }
    ["REACH"]=&gt;
    object(SimpleXMLElement)#6 (1) {
      ["@attributes"]=&gt;
      array(1) {
        ["RANK"]=&gt;
        string(1) "4"
      }
    }
    ["RANK"]=&gt;
    object(SimpleXMLElement)#5 (1) {
      ["@attributes"]=&gt;
      array(1) {
        ["DELTA"]=&gt;
        string(2) "+0"
      }
    }
  }
}
</code></pre>
