Хз - 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 Хз.php
- <?php
- function isJSON($string) {
- if(is_array($string)) return false;
- if(!empty($string)){
- if($string == '{}') return true;
- json_decode($string);
- if(json_last_error() === JSON_ERROR_NONE) return true;
- }
- return false;
- }
- $json = '{"website":{"domain":"wtools.io","title":"Online Web Tools"}}';
- if(isJSON($json)){
- echo "Valid JSON string";
- } else {
- echo "Not valid JSON string";
- }