. Advertisement .
..3..
. Advertisement .
..4..
Hi everyone, I’m learning about php. While working, I try use json_decode(). As a result, I get the message:
Fatal error: Cannot use object of type stdClass as array in
C:\Users\Dail\software\abs.php on line 108
What can I do about the “cannot use object of type stdclass as array” issue? Is there a better approach?
The cause: This error happens it’s an object but you didn’t use
->
to access to it.The solution: To fix this problem, you should change your code from:
To:
To make it return an array, use the second parameter in
json_decode