title: PHP: How to print row of multidimensional array with conditions
body: <p>I'm a PHP beginner. I would like to print rows based on specific condition. For Example, I have a set of Data from SQL-Query(shown below) and I want to print all rows of [Series no] only when Type = 210 and Category = J. I know 'foreach' loop should be used in this case, but I do not know how.</p>
  <p><img src="https://i.stack.imgur.com/us2nm.png" alt="Table from SQL-Query" /></p>
  <p>And this is what I've tried. I know it is wrong but as I said I am a beginner and self learning.</p>
  <pre><code>$get_data = sqlsrv_query($connde, $mainquery);
  
  $data_array = [];
  while ($row = sqlsrv_fetch_array($get_data, SQLSRV_FETCH_ASSOC)) {
      $data_array[$row[&quot;Type&quot;]][$row[&quot;Category&quot;]][$row[&quot;Series No&quot;]][$row[&quot;End Date&quot;]];
  }
  
  
  foreach ($data_array as $value1) {
      if ($value1 = 210) {
          foreach ($value1 as $value2) {
              if isset($value2 == 'J')
              echo &quot;&lt;td&gt;&quot; . $row[&quot;Series No&quot;] . &quot;&lt;/td&gt;&quot;;
  
          }
      }
  }
  </code></pre>