title: Add properties to stdClass object from another object
body: <p>I would like to be able to do the following:</p>
  
  <pre><code>$obj = new stdClass;
  $obj-&gt;status = "success";
  
  $obj2 = new stdClass;
  $obj2-&gt;message = "OK";
  </code></pre>
  
  <p>How can I extend $obj so that it contains the properties of $obj2, eg:</p>
  
  <pre><code>$obj-&gt;status //"success"
  
  $obj-&gt;message // "OK"
  </code></pre>
  
  <p>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:</p>
  
  <p>extend($obj, $obj2); //adds all properties from $obj2 to $obj</p>
  
  <p>Thanks!</p>