task_2 - 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.
Result of php executing
Full code of task_2.php
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- </head>
- <body>
- <?php
- $m = rand(4, 8);
- $n = rand(4, 8);
- echo("<table style='width: 800px; height: 800px; border: 1px solid black; border-collapse: collapse'>");
- for ($i=1; $i<$m+1; $i++) {
- echo("<tr>");
- for ($j=1; $j<$n+1; $j++) {
- if ($i < $j) {
- echo("<td style='background: red; border: 1px solid black'></td>");
- } else {
- echo("<td style='border: 1px solid black'></td>");
- }
- }
- echo("</tr>");
- }
- echo("</table>");
- ?>
- </body>
- </html>