Advertisement
nenhumdeucerto

Desafio 002

Apr 13th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2. function mostrar($p){
  3.     $tot = count($p);
  4.     for ($i=0; $i<$tot; $i++){
  5.         $tot1 = count($p[$i]);
  6.         echo "<div style='display:flex;'>";
  7.         for($y=0; $y<$tot1;$y++){
  8.             if ($p[$i][$y]==0){
  9.                 echo "<div style='width:10px;height:10px;background:#000;'>  </div>" ;
  10.             } else {
  11.                 echo "<div style='width:10px;height:10px;background:#FFF;'>  </div>" ;
  12.             }
  13.         }
  14.         echo "</div>";
  15.     }
  16. }
  17.  
  18. $array = array(
  19.     array(0, 0, 0, 0, 1, 0),
  20.     array(0, 1, 1, 1, 1, 0),
  21.     array(0, 1, 0, 0, 0, 0),
  22.     array(0, 1, 1, 1, 1, 0),
  23.     array(0, 0, 0, 0, 1, 1),
  24.     array(0, 0, 0, 0, 0, 0)
  25. );
  26.  
  27. mostrar($array);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement