3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isJson($string) { json_decode($string); return (json_last_error() == JSON_ERROR_NONE); } $str1 = '{ "firstName": "Bidhan" "lastName": "Chatterjee", "age": 40, "email":"bidhan@example.com" }'; $x=isJson($str1); echo $x; ?>

preferences:
51.22 ms | 402 KiB | 5 Q