PHP 8.1 Array to Object Conversion with `json_decode`, Unexpected Type Handling
I'm dealing with I tried several approaches but none seem to work..... I've been working on a project using PHP 8.1 and I'm working with an scenario with converting an array to an object using `json_decode`. I have an associative array that I want to convert into a class object, but I'm working with unexpected behavior when dealing with nested arrays. Here's what I'm doing: ```php $data = [ 'name' => 'John', 'age' => 30, 'address' => [ 'city' => 'New York', 'zip' => '10001' ] ]; $json = json_encode($data); $object = json_decode($json); ``` After this code runs, I expect `$object->address` to be an object as well, but it's still an array. I want to ensure that all nested structures are also converted to objects, not arrays. I've tried using the second parameter of `json_decode` to convert it into an associative array first, but that doesn't guide to achieve my goal of an object hierarchy. I've also looked at using `array_to_object()` functions but they seem to complicate things further. It bothers me that `json_decode` doesnβt handle this recursively. Is there a recommended way to ensure that all nested arrays are also converted to objects in PHP 8.1? Any insights would be appreciated, especially if someone has encountered similar issues. This is for a CLI tool running on CentOS. Any pointers in the right direction?