Created
February 8, 2022 07:34
-
-
Save yehchge/5e94ac28092a4fb6efcd28a405995be7 to your computer and use it in GitHub Desktop.
php is_json value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function is_json($json_string = "") | |
{ | |
return is_string($json_string) && | |
is_array(json_decode($json_string, true)) && | |
(json_last_error() == JSON_ERROR_NONE) ? true : false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment