I'm trying to store the value of ok
in a variable starting from a json file but the output isn't what I'm expecting it to be.
Here's my code:
$messaggio = '{"ok":false,"error_code":400,"description":"Bad Request"}';
$messaggio = json_decode($messaggio, true);
print_r($messaggio);
Output: Array ( [ok] => [error_code] => 400 [description] => Bad Request)
Shoudn't it be like this? Array ( [ok] => false [error_code] => 400 [description] => Bad Request)
And if it shouldn't, how can I store the value of ok
in a variable?