title: php stdobject - calling a default function
body: <p>i am using the stdObject methodology for my program, i am wondering if it is possible to call a function without assigning a method, some code will help clarify :  </p>
  
  <pre><code>//from php.net
  class stdObject {
    public function __call($method, $arguments) {
      if (isset($this-&gt;{$method}) &amp;&amp; is_callable($this-&gt;{$method})) {
        return call_user_func_array($this-&gt;{$method}, $arguments);
      } else {
        throw new Exception("Fatal error: Call to undefined method stdObject::{$method}()");
    }
  }
  
  $o=new stdObject();
  
  $o();
  </code></pre>
  
  <p>so i know i can dynamically add methods such as</p>
  
  <pre><code>$o-&gt;a=function(){};
  </code></pre>
  
  <p>but i would like to be able to call a function like so $o(), kind of like in javascript :</p>
  
  <pre><code>function fn(){}
  fn.test=function(){}
  
  fn();
  fn.test();
  </code></pre>