If we have a PHP array and want to cast it to an object, is it necessary to reassign the variable? and is there any performance benefits to this?
$key_value = ('key1'=>'value1' , 'key2'=>'value2');
$key_value = (object)$key_value; //We can reassign as an object
//Is there a way to, without reassigning, just cast the type of the already assigned variable?
//Is this advantageous in terms of performance?
(object)$key_value; //is this the correct syntax, considering it is even possible?
In most cases this is probably irrelevant, but it got me curious towards the theory behind it.