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

  1. <?php
  2.  
  3. /* //Echo command
  4.  
  5. $my_user = "Claire";
  6.  
  7. echo "Hello World ".$my_user."\n";
  8.  
  9. //php is not strictly type
  10.  
  11. $my_tel = 7739673036;
  12.  
  13. $my_float = 0.2;
  14.  
  15. $my_string = "My details";
  16.  
  17. $my_tel = "7739673036";
  18.  
  19. $result = $my_tel . $my_float;
  20.  
  21. echo " $result \n "; 
  22.  
  23. */
  24.  
  25. /* //Numbers commands and IF
  26.  
  27. $numx = 3400;
  28. $numy = 2200;
  29. $result = $numx-$numy;
  30.  
  31. $result = $result - 745;
  32.  
  33. echo "my calculation: $result \n ";
  34.  
  35. if($result < 800) {
  36.     echo "my calculations: $result \n";
  37. }
  38.  
  39. */
  40.  
  41. /* // More IF
  42.  
  43. $today = "Sunday";
  44.  
  45. if($today==='Saturday' || $today=="Sunday"){
  46.     echo "it is the weekend";
  47. } else {
  48.     echo "it is not the weekend, but $today \n";
  49. }
  50.  
  51. */
  52.  
  53.  //ARRAY
  54.  
  55. $week = ["MON", "TUES", "WED", "THUR", "FRI"];
  56.  
  57. //print_r($week);
  58.  
  59. // PUSH
  60.  
  61. $week[] = "SAT";
  62. array_push($week, "SUN");
  63. $week[] = "DEAD";
  64. //print_r($week);
  65.  
  66. foreach($week as $val){
  67.     //iteration
  68. }
  69.  
File Description
  • begin
  • PHP Code
  • 23 Sep-2022
  • 861 Bytes
You can Share it: