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

  1. <?php
  2.  
  3. ###################################################################
  4. #####TEST 1########################################################
  5. ###################################################################
  6.  
  7. echo "Test 1: ";
  8.  
  9. $array = ["apple", "", 0, 2, null, -5, "0", "orange", 10, false];
  10.  
  11. //Remove null, false, and ""(empty string) values from the array
  12.  
  13. echo array_values($array) === ["apple", 0, 2, -5, "0", "orange", 10] ? "OK" : "FALSE";
  14.  
  15.  
  16. ###################################################################
  17. #####TEST 12#######################################################
  18. ###################################################################
  19.  
  20. echo "\n Test 2: ";
  21.  
  22. $array2 = [10, 12, 33, 15, 42, 1, -5, 11, 1, 2, 4];
  23.  
  24. //Sort an array in descending order
  25. rsort($array2,SORT_NUMERIC);
  26.  
  27. echo $array2 === [42,33,15,12,11,10,4,2,1,1,-5] ? "OK" : "FALSE";
  28.  
  29.  
  30.  
File Description
  • Test
  • PHP Code
  • 05 Jan-2023
  • 865 Bytes
You can Share it: