[wp-hackers] Passing class methods by reference

Michael D Adams mda at blogwaffe.com
Fri Aug 6 21:20:21 UTC 2010


On Fri, Aug 6, 2010 at 2:16 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> On Aug 5, 2010, at 2:57 PM, Michael D Adams wrote:
>> Static class methods are slow, though.
>
> Hmm.    I was curious about this so decided to ask on StackOverflow and it doesn't seem to be the consensus. Maybe they are missing something?
>
>        http://stackoverflow.com/questions/3418582/performance-of-singleton-class-instance-method-vs-static-class-method-in-php/

Sorry - I meant compared to straight functions.  The context (in my head) was

$object_i_can_use = My_Class::instance();
vs.
$object_i_can_use() = my_class_instance();

Where the former stores the as a static property or variable, and the
later accesses a previously created global.

I didn't actually benchmark that specific scenario, though, so I
probably shouldn't even have mentioned it :)


More information about the wp-hackers mailing list