I would like to be able to do the following:
$obj = new stdClass;
$obj->status = "success";
$obj2 = new stdClass;
$obj2->message = "OK";
How can I extend $obj so that it contains the properties of $obj2, eg:
$obj->status //"success"
$obj->message // "OK"
I know I could use an array, add all properties to the array and then cast that back to object, but is there a more elegant way, something like this:
extend($obj, $obj2); //adds all properties from $obj2 to $obj
Thanks!