The Note You're Voting On
jdpsaratoga at gmail dot com ¶ 4 months ago
If you json_encode() an associative array it is encoded as an object, not an array. For example
echo json_encode( ["a"=>42, "b"=>99] );
will result in: {"a":42,"b":99} which is the JSON representation of an object, not an array. The encode has lost the information that this was an array originally.
So this means if you decode the above it will refuse to accept it as an argument for any array functions.
You can cast it to an array or set the second parameter in the decode, but that assumes you were the one that encoded it and knew it was supposed to be an array.