Advertisement
nenhumdeucerto

Desafio 003

Apr 13th, 2018
73
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. $array = array(
  18.     array(0, 1, 0, 1, 0, 1),
  19.     array(1, 0, 1, 0, 1, 0),
  20.     array(0, 1, 0, 1, 0, 1),
  21.     array(1, 0, 1, 0, 1, 0),
  22.     array(0, 1, 0, 1, 0, 1),
  23.     array(1, 0, 1, 0, 1, 0)
  24. );
  25.  
  26. mostrar($array);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement