title: show/hide table in PHP code
body: <p>I need to hide a table using if condition inside my following PHP code. I'm trying to use CSS for this but it seems CSS cannot read the if condition and it always runs and overrides.I want to implement it without taking table creation tags inside the if condition. Thanks</p>
  
  <pre><code>&lt;?php
  $arr=array(array(1,2,3,4,5),array(6,7,8,9));
  foreach ($arr as $val)
  {
      echo '&lt;table border="1" id="table1" align="center"   style="float:center;"&gt;';
      for($i=0;$i&lt;sizeof($val);$i++)
      {
          echo '&lt;tr&gt;&lt;td&gt;'.$val[$i].'&lt;/td&gt;&lt;/tr&gt;';
          if($val[$i]&gt;5)
          {?&gt;
              &lt;style&gt;
              #table1 { visibility:hidden; }
              &lt;/style&gt;
              &lt;?php
          }
          else
          {?&gt;
              &lt;style&gt;
              #table1 { visibility: visible !important;}
              &lt;/style&gt;
              &lt;?php
          }
      }
      echo'&lt;br/&gt;';
      echo '&lt;/table&gt;';
  }
  ?&gt;
  </code></pre>