Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $columns = ["#", "-#", "x", "/", "%"];
- $rows = 10;
- $sums = [];
- echo("
- <table>
- <tr>
- ");
- for ($i = 0; $i < count($columns); $i++){
- echo("<th>".$columns[$i]."</th>");
- }
- echo("<tr>");
- $cells = [];
- for ($i = 1; $i <= $rows; $i++){
- echo("<tr>");
- for ($v = 0; $v < count($columns); $v++){
- if ($v == 0){
- echo("<td>".$i."</td>");
- $cells[$v] = $i;
- }
- elseif ($v == 1){
- echo("<td>".($rows - $i + 1)."</td>");
- $cells[$v] = $rows - $i + 1;
- }
- elseif ($v == 2){
- echo("<td>".($cells[0] * $cells[1])."</td>");
- $cells[$v] = $cells[0] * $cells[1];
- }
- elseif ($v == 3){
- echo("<td>".($cells[0] / $cells[1])."</td>");
- $cells[$v] = $cells[0] / $cells[1];
- }
- elseif ($v == 4){
- echo("<td>".($cells[0] % $cells[1])."</td>");
- $cells[$v] = $cells[0] % $cells[1];
- }
- @$sums[$v] += @$cells[$v];
- }
- echo("</tr>");
- }
- echo("<tr>");
- for ($i = 0; $i < count($sums); $i++){
- echo("<th>".$sums[$i]."</th>");
- }
- echo(
- "<tr>
- </table>
- ");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement