title: Why can't I seem to access elements of a multi dimensional array?
body: <p>I have an XML file that was converted into an array with xpath. Ultimately I want to be able to access the variables in the array but no method seems to work.</p>
  
  <p><code>echo $items['member']['name'];</code> Does not work<br>
  <code>echo $items['name'];</code> Nor this<br>
  <code>echo $items['members']['member']['name'];</code> Nor this<br>
  <code>echo $items[0][0]</code> Nor this<br>
  <code>echo $items[0]</code> Nor this<br>
  <code>echo $items[0]['object']['name']</code>Nor this<br>
  <code>$items[0]['name']</code>Nor this</p>
  
  <p>I have no no what the problem is but I imagine it might be with xpath and it's effect on the array. I understand that there are other similar threads but no resource seems to help. </p>
  
  <p><strong>PHP:</strong>
      
  
  <pre><code>    $xml = simplexml_load_file('XML/profiles.xml'); //Create XML variable from XML file.
  
      $items = $xml-&gt;xpath('member');
  
      var_dump($items);
      ?&gt;
  </code></pre>
  
  <p><strong>XML:</strong>
      </p>
  
  <pre><code>    &lt;member&gt;
          &lt;name&gt;AndrewHarvey&lt;/name&gt;
          &lt;location&gt;Carleton-Victoria&lt;/location&gt;
          &lt;party&gt;L&lt;/party&gt;
      &lt;/member&gt;
  
      &lt;member&gt;
          &lt;name&gt;BenoitBourque&lt;/name&gt;
          &lt;location&gt;Kent North&lt;/location&gt;
          &lt;party&gt;L&lt;/party&gt;
      &lt;/member&gt;
  
      &lt;member&gt;
          &lt;name&gt;BernardLeBlanc&lt;/name&gt;
          &lt;location&gt;Memramcook-Tantramar&lt;/location&gt;
          &lt;party&gt;L&lt;/party&gt;
      &lt;/member&gt;
  
      &lt;member&gt;
          &lt;name&gt;BertrandLeBlanc&lt;/name&gt;
          &lt;location&gt;Kent North&lt;/location&gt;
          &lt;party&gt;L&lt;/party&gt;
      &lt;/member&gt;
  
      &lt;member&gt;
          &lt;name&gt;BillFraser&lt;/name&gt;
          &lt;location&gt;Miramichi&lt;/location&gt;
          &lt;pos&gt;Tourism&lt;/pos&gt;
          &lt;pos&gt;Heritage and Culture&lt;/pos&gt;
          &lt;pos&gt;Northern and Miramichi Funds&lt;/pos&gt;
          &lt;party&gt;L&lt;/party&gt;
      &lt;/member&gt;
  and so on...
  </code></pre>
  
  <p><strong>Var dump of $array:</strong></p>
  
  <pre><code>array (size=49)  
        0 =&gt;   
        object(SimpleXMLElement)[2]  
        public 'name' =&gt; string 'AndrewHarvey' (length=12)  
        public 'location' =&gt; string 'Carleton-Victoria' (length=17)  
        public 'party' =&gt; string 'L' (length=1)  
    1 =&gt;   
      object(SimpleXMLElement)[3]  
        public 'name' =&gt; string 'BenoitBourque' (length=13)  
        public 'location' =&gt; string 'Kent North' (length=10)  
        public 'party' =&gt; string 'L' (length=1)  
    2 =&gt; 
      object(SimpleXMLElement)[4]
        public 'name' =&gt; string 'BernardLeBlanc' (length=14)
        public 'location' =&gt; string 'Memramcook-Tantramar' (length=20)
        public 'party' =&gt; string 'L' (length=1)
    3 =&gt; 
      object(SimpleXMLElement)[5]
        public 'name' =&gt; string 'BertrandLeBlanc' (length=15)
        public 'location' =&gt; string 'Kent North' (length=10)
        public 'party' =&gt; string 'L' (length=1)
    4 =&gt; 
      object(SimpleXMLElement)[6]
        public 'name' =&gt; string 'BillFraser' (length=10)
        public 'location' =&gt; string 'Miramichi' (length=9)
        public 'pos' =&gt; 
          array (size=3)
            0 =&gt; string 'Tourism' (length=7)
            1 =&gt; string 'Heritage and Culture' (length=20)
            2 =&gt; string 'Northern and Miramichi Funds' (length=28)
  and so on...
  </code></pre>