private function getMessageFromErrorCode($error)
        {
            if (function_exists('json_last_error_msg')) {
                return json_last_error_msg();
            }
            $errors = array(
               JSON_ERROR_NONE             => null,
               JSON_ERROR_DEPTH            => 'Maximum stack depth exceeded',
               JSON_ERROR_STATE_MISMATCH   => 'Underflow or the modes mismatch',
               JSON_ERROR_CTRL_CHAR        => 'Unexpected control character found',
               JSON_ERROR_SYNTAX           => 'Syntax error, malformed JSON',
               JSON_ERROR_UTF8             => 'Malformed UTF-8 characters, possibly incorrectly encoded'
           );
            return array_key_exists($error, $errors) ? $errors[$error] : "Unknown error ({$error})";
        }
private function getMessageFromErrorCode($error)
        {
            if (function_exists('json_last_error_msg')) {
                return json_last_error_msg();
            }
            $errors = array(
               JSON_ERROR_NONE             => null,
               JSON_ERROR_DEPTH            => 'Maximum stack depth exceeded',
               JSON_ERROR_STATE_MISMATCH   => 'Underflow or the modes mismatch',
               JSON_ERROR_CTRL_CHAR        => 'Unexpected control character found',
               JSON_ERROR_SYNTAX           => 'Syntax error, malformed JSON',
               JSON_ERROR_UTF8             => 'Malformed UTF-8 characters, possibly incorrectly encoded'
           );
            return array_key_exists($error, $errors) ? $errors[$error] : "Unknown error ({$error})";
        }
private function getMessageFromErrorCode ( $ error ) { if ( function_exists ( 'json_last_error_msg' ) ) { return json_last_error_msg ( ) ; } $ errors = array ( JSON_ERROR_NONE => null , JSON_ERROR_DEPTH => 'Maximum stack depth exceeded' , JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch' , JSON_ERROR_CTRL_CHAR => 'Unexpected control character found' , JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON' , JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded' ) ; return array_key_exists ( $ error , $ errors ) ? $ errors [ $ error ] : "Unknown error ({$error})" ; }
Support json_last_error_msg in PHP 5.2
@param string $error
@return string
Support json_last_error_msg in PHP 5 . 2