3x3 matrix - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of 3x3 matrix.php

  1. <?php
  2. $a=array(array(2,5),array(0,7),array(3,6));
  3. $b=array(array(2,9),array(5,7),array(1,7));
  4. $c=array(array(9,2),array(5,1),array(1,9));
  5.  
  6. for($i=0;$i<3;$i++){
  7.     for($j=0;$j<3;$j++)
  8.     {
  9.        for($k=0;$k<3;$k++)
  10.         {
  11.             echo ($a[$i][$j][$k]+$b[$i][$j][$k]+$c[$i][$j][$k]);
  12.         }
  13.         echo "<br>"; 
  14.     }
  15.     echo "<br>";
  16. }
  17.  
  18.  
  19. ?>
File Description
  • 3x3 matrix
  • PHP Code
  • 03 Dec-2022
  • 353 Bytes
You can Share it: