This question already has an answer here:
- PHP - recursive Array to Object? 14 answers
i have seen a lot of examples but was unsuccessful to help myself. I have a multidimensional array that i want to convert to object format. I tried going levels deeper (multidimensional) but that all. I want to make it an php object. This is my scenario
// this is my array
Array
(
[_cars] => Array
(
[_car] => Array
(
[0] => Array
(
[_types] => Array
(
[_type] => Array
(
[0] => Array
(
[_cc] => 100
)
[1] => Array
(
[_cc] => 100
)
[2] => Array
(
[_cc] => 1000
)
)
)
)
)
)
)
)
// this is what i want
[_cars] => stdClass Object
(
[_car] => Array
(
[0] => stdClass Object
(
[_types] => stdClass Object
(
[_type] => Array
(
[0] => stdClass Object
(
[_cc] => 999999999999
)
[1] => stdClass Object
(
[_cc] => 999999999999
)
[2] => stdClass Object
(
[_cc] => 999999999999
)
)
)
)
)
)
</div>