json_last_error
brefphp/bref
Supported Versions: PHP 5 >= 5.3.0, PHP 7, PHP 8
Returns the last error occurred
json_last_error
():
int
$lastLine
=
end
(
$output
);
if (! empty(
$lastLine
)) {
$result
=
json_decode
(
$lastLine
,
true
,
512
,
JSON_THROW_ON_ERROR
);
if (
json_last_error
()) {
throw new
Exception
(
json_last_error_msg
());
}
} else {
tests/Sam/PhpRuntimeTest.php
$error
=
trim
(
$matches
[
1
] ??
''
);
if (
$error
!==
''
) {
$result
=
json_decode
(
$error
,
true
,
512
,
JSON_THROW_ON_ERROR
);
if (
json_last_error
()) {
throw new
Exception
(
json_last_error_msg
());
}
}
tests/Sam/PhpRuntimeTest.php