<?php
foreach([
'null',
'true',
'false',
'"text"',
'123',
'1E2',
'[1,2,3]',
'{"foo":"bar"}',
] as $json)
{
var_dump(json_decode($json, true));
assert(json_last_error() === JSON_ERROR_NONE);
}
- Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- NULL
bool(true)
bool(false)
string(4) "text"
int(123)
float(100)
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(1) {
["foo"]=>
string(3) "bar"
}
preferences:
149.38 ms | 403 KiB | 168 Q