Хз - 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 Хз.php

  1. <?php
  2. function isJSON($string) {
  3.     if(is_array($string)) return false;
  4.     if(!empty($string)){
  5.         if($string == '{}') return true;
  6.         json_decode($string);
  7.         if(json_last_error() === JSON_ERROR_NONE) return true;
  8.     }
  9.     return false;
  10. }
  11.  
  12. $json = '{"website":{"domain":"wtools.io","title":"Online Web Tools"}}';
  13. if(isJSON($json)){
  14.     echo "Valid JSON string";
  15. } else {
  16.     echo "Not valid JSON string";
  17. }
  18.  
File Description
  • Хз
  • PHP Code
  • 25 Mar-2024
  • 426 Bytes
You can Share it: