title: How to add a new method to a php object on the fly?
body: <p>How do I add a new method to an object "on the fly"?</p>
  
  <pre><code>$me= new stdClass;
  $me-&gt;doSomething=function ()
   {
      echo 'I\'ve done something';
   };
  $me-&gt;doSomething();
  
  //Fatal error: Call to undefined method stdClass::doSomething()
  </code></pre>