title: PHP Multidimensional Array push and loop
body: <p>I'm having some trouble understanding the coding in PHP, when it comes to multidimensional arrays and how to push.
  The idea is to push a "Attribute" and a "Attribute value"</p>
  
  <p>I have tried the formula below</p>
  
  <pre><code>   $i = 0;
     $array = array();
      foreach($node as $a)
      {
          $strAtt = $node-&gt;PROP[$i]-&gt;attributes();
          $strVal = $node-&gt;PROP[$i]-&gt;PVAL;
  
          $output = $output.$strAtt." : ".$strVal."&lt;BR&gt;";
          $array[] = ($strAtt =&gt; $strVal);
  </code></pre>
  
  <p>The <strong>$array[] = ($strAtt => $strVal);</strong> doesnt give me much success.
  I have tried <strong>array_push($array, $strAtt => $strVal)</strong> - no luck..<p>
  As an extra questions, how do I loop trough the array and print me multidimensional values ?.</p>
  
  <p><strong>NEW CODE</strong></p>
  
  <pre><code>while ($z-&gt;name === 'RECORD')
  {
  
  $node = new SimpleXMLElement($z-&gt;readOuterXML());
  
  $Print = FALSE;
  $output = "";
  $i = 0;
  foreach($node as $a)
  {
      $strAtt = $node-&gt;PROP[$i]-&gt;attributes();
      $strVal = $node-&gt;PROP[$i]-&gt;PVAL;
  
      $output = $output.$strAtt." : ".$strVal."&lt;BR&gt;";
      $array[$strAtt] = $strVal;
  
      if(($i == 6) &amp;&amp; ($node-&gt;PROP[$i]-&gt;PVAL == $ProductLookup))
      {
          $Print = TRUE;
          $Product = $node-&gt;PROP[$i]-&gt;PVAL;
      }       
  
      $i++;
  }
  if($Print == TRUE) {
      echo $output;
      echo "Product : ".$Product."&lt;br&gt;";
      var_dump($array);
      }
  
      //print_r($array);
      $print = FALSE;
  
  // go to next &lt;product /&gt;
  $z-&gt;next('RECORD');
  }
  </code></pre>
  
  <p>New code added. For some reason my $array is totally empty when i dump it, although my $Output is full of text ?</p>