[wp-hackers] Micro optimization - is_a() vs instanceof

Justas Butkus jbutkus at time.ly
Sun Jan 6 20:18:44 UTC 2013

On 2013.01.04 21:49, Andrew Nacin wrote:
> You should take a lunch to test your patch:-)
> $a instanceof Some_Object
> not
> $a instanceof 'Some_Object'
Actually I would say, that especially, if targeting PHP prior to 5.1, it 
is a good approach, to keep class names as scalar references (strings), 
and not as references handled by PHP.

That's according to http://us.php.net/instanceof Example #7. :-)

And as others pointed out - any case would work.
But that's more of an example - it still needs more of a decision, than 
patch, as I understand.

Kind regards,
Justas B.

More information about the wp-hackers mailing list