title: Add method in an std object in php
body: <p>Is it possible to add a method/function in this way, like</p>
  
  <pre><code>$arr = array(
      "nid"=&gt; 20,
      "title" =&gt; "Something",
      "value" =&gt; "Something else",
      "my_method" =&gt; function($arg){....}
  );
  </code></pre>
  
  <p>or maybe like this</p>
  
  <pre><code>$node = (object) $arr;
  $node-&gt;my_method=function($arg){...};
  </code></pre>
  
  <p>and if it's possible then how can I use that function/method?</p>