[wp-trac] Re: [WordPress Trac] #10264: use instanceof instead of is_a()

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 1 19:07:53 UTC 2009


#10264: use instanceof instead of is_a()
-------------------------+--------------------------------------------------
 Reporter:  Mittineague  |       Owner:                
     Type:  enhancement  |      Status:  assigned      
 Priority:  low          |   Milestone:  Future Release
Component:  Performance  |     Version:  2.8           
 Severity:  normal       |    Keywords:  needs-patch   
-------------------------+--------------------------------------------------

Comment(by Mittineague):

 I think I may have thought of a better solution then testing for support
 of the instanceof operator that will still be faster than is_a and not
 throw errors of any type.

 eg.
 {{{
 //      if ( !is_a($wp_scripts, 'WP_Scripts') )
         if ( !( get_class($wp_scripts) == 'WP_Scripts' ) )
 }}}
 get_class is even a little faster than instanceof and was introduced in
 PHP version 4

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10264#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list