[wp-trac] [WordPress Trac] #10493: Allow closures as callbacks

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 26 23:56:40 UTC 2009


#10493: Allow closures as callbacks
-------------------------+--------------------------------------------------
 Reporter:  scribu       |       Owner:  scribu   
     Type:  enhancement  |      Status:  new      
 Priority:  normal       |   Milestone:  2.9      
Component:  General      |     Version:  2.9      
 Severity:  normal       |    Keywords:  has-patch
-------------------------+--------------------------------------------------
 PHP 5.3 allows closures, which means we can replace this:

 {{{
 add_action('init', create_function('', '//do something'));
 }}}

 with this:

 {{{
 add_action('init', function() { // do something });
 }}}

 and it only requires two lines of extra code.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10493>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list