Creating default object from empty value in PHP?
Yes, use arrays.

$car = [
   'general' =&gt; [
        'interior' =&gt; [
            'seats' =&gt; 'destroyed'
        ]
    ]
];

$exteriorProperties = [
    'hood' =&gt; 'shiny',
    'windows' =&gt; 'dirty'
];

foreach($exteriorProperties as $key =&gt; $prop){
    $car['other']['exterior'][$key] = $prop;
}
$car = (object) $car;


Anyway, the object conversion will only convert the outermost array. The nested arrays are still arrays.

\is_array($car-&gt;general); // true


Why you need it to be shapeless objects anyway? Either define classes for those objects or treat them as arrays is the simple answer.

Btw $car-&gt;{'other'} is really weird way of writing $car-&gt;other...