task_1 - 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 task_1.php

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5. </head>
  6. <body>
  7. <?php
  8. $a = rand(20, 50);
  9. echo("<p>Your number: $a</p>");
  10. echo("<p>Dividers:</p>");
  11. echo("<ol>");
  12. for ($i=1; $i<$a+1; $i++) {
  13.     if ($a % $i == 0) {
  14.         echo("<li>$i</li>");
  15.     }
  16. }
  17. echo("</ol>");
  18. ?>
  19. </body>
  20. </html>
File Description
  • task_1
  • PHP Code
  • 20 Jan-2022
  • 301 Bytes
You can Share it: