title: iterate multidimensional array and retrieve both single value together with array values
body: <p>I have the following array that I need to iterate. I need to get the header value and then each &quot;team&quot; and &quot;picture&quot; value. How can I do that? I tried this but that give me an error &quot;Illegal string offset 'team'&quot;.</p>
  <p><a href="https://i.stack.imgur.com/Q7fjN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q7fjN.jpg" alt="enter image description here" /></a></p>
  <pre><code>        $xml = simplexml_load_file($fileName);
      
      //print_r($xml);
      $eventHeader = $xml-&gt;title;
      
      // standings array
          $standings_arr=array();
          $standings_arr[&quot;standings&quot;]=array(&quot;header&quot; =&gt;(string)$eventHeader);
   
      foreach($xml-&gt;row as $item)
      {
           $standings_item=array(
          &quot;team&quot; =&gt; (string)$item-&gt;team,
          &quot;picture&quot; =&gt; (string)$item-&gt;picture,
          &quot;v&quot; =&gt; (string)$item-&gt;v,
          &quot;f&quot; =&gt; (string)$item-&gt;f,
          &quot;p&quot; =&gt; (string)$item-&gt;p
         );
          array_push($standings_arr[&quot;standings&quot;], $standings_item);
      }
  
      foreach ($standings_arr as $row ) {
        
        $header = $row['header'];
  
        if (is_array($row)) 
        { 
          foreach ( $row as $key =&gt; $value ) {
            echo $value['team'];
          }
        }
      }
  </code></pre>
  <p>Can someone guide me please?</p>