table? - 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 table?.php

  1. <?php
  2. $rows = array(
  3.         array(1,2,3,0,4,5,3,6,3,6,0,7,5,6,8),
  4.         array(4,7,3,1,4,5,4,4,3,6,4,7,5,6,8),
  5.         array(5,3,3,2,4,5,0,5,3,6,5,7,3,6,8),
  6.         array(6,0,5,3,4,5,5,6,4,6,6,3,4,6,8),
  7.         array(3,0,6,7,4,5,4,6,5,6,0,7,5,0,8),
  8.         array(1,0,3,8,4,5,0,7,3,6,0,7,5,0,8),
  9.         array(4,0,3,0,4,5,0,3,3,6,0,7,5,6,0),
  10.         array(5,0,3,0,4,5,0,6,3,6,0,7,5,6,8),
  11. );
  12. ?>
  13. <style>
  14. table { width:100%; border-top:1px solid; border-left:1px solid;}
  15. td { min-width: 50px; text-align:center;  border-bottom:1px solid; }
  16. td:last-child { border-right:1px solid; }
  17. tr:first-child td:first-child { border-right:1px solid; }
  18. </style>
  19. <table cellspacing="0" cellpadding="0" style="table-layout:fixed">
  20.         <?php foreach( $rows as $key => $row ){?>
  21.         <tr>
  22.                 <?php if( $key == 0 ){?>
  23.                 <td rowspan="<?=count($rows)?>"> Subject </td>
  24.                 <?php }?>
  25.                 <?php foreach( $row as $td ){?>
  26.                 <td><?=$td?$td:""?></td>
  27.                 <?php }?>
  28.         </tr>
  29.         <?php }?>
  30. </table>
File Description
  • table?
  • PHP Code
  • 16 Jan-2023
  • 894 Bytes
You can Share it: