title: Convert/cast an stdClass object to another class
body: <p>I'm using a third party storage system that only returns me stdClass objects no matter what I feed in for some obscure reason. So I'm curious to know if there is a way to cast/convert an stdClass object into a full fledged object of a given type. </p>
  
  <p>For instance something along the lines of:</p>
  
  <pre><code>//$stdClass is an stdClass instance
  $converted = (BusinessClass) $stdClass;
  </code></pre>
  
  <p>I am just casting the stdClass into an array and feed it to the BusinessClass constructor, but maybe there is a way to restore the initial class that I am not aware of.</p>
  
  <p>Note: I am not interested in 'Change your storage system' type of answers since it is not the point of interest. Please consider it more an academic question on the language capacities.</p>
  
  <p>Cheers</p>