[wp-trac] Re: [WordPress Trac] #9059: Why is WP using empty()? (was:
single_cat_title wont show category called 0)
WordPress Trac
wp-trac at lists.automattic.com
Thu Apr 16 17:36:20 GMT 2009
#9059: Why is WP using empty()?
--------------------------+-------------------------------------------------
Reporter: noonoo | Owner: anonymous
Type: defect (bug) | Status: new
Priority: low | Milestone: 2.8
Component: Optimization | Version: 2.7
Severity: minor | Keywords: needs-patch dev-feedback
--------------------------+-------------------------------------------------
Changes (by Denis-de-Bernardy):
* keywords: needs-patch => needs-patch dev-feedback
* component: Template => Optimization
* milestone: => 2.8
Comment:
On a more general note, why in the bloody hell is empty() used throughout
WP.
I did a few tests on my end while wondering whether empty() or casting to
boolean works fastest, and the latter beats the former by a landslide.
{{{
if ( !empty($foo) )
...
}}}
is slower than:
{{{
if ( !$foo )
...
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9059#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list