Hey,
Why is this thread not titled "return of the bikeshed"? I've seen this one so many times over the past few days. Wonder how many man-days have been wasted on this :)
It doesn't seem faster to me.
Those benchmarks are only testing some rather small arrays no?
I did some stuff a while back as well: https://github.com/JeroenDeDauw/php/blob/master/profile/array-empty.php
If you really want something that is readable by users who are unfamiliar with PHP, you can always use !count( $array ).
I am very dubious that this is actually clearer. In any case, this one IS less efficient.
Currently our coding conventions have major prohibitions on the use of
isset() ...
Oh, would not think so if you did a grep on core.
... and empty()
I used to use this for array empty checks, and though some people complained, just as many thought it was perfectly fine.
Anyway, if you are thinking of reaching a consensus on the list here and enforce everyone to use the form you like, good luck. Such a thing might happen of course if we wait long enough, though I wonder if protons will decay before that or not. Anyone want to place a bet? I'm going for proton decay winning.
Cheers
-- Jeroen De Dauw http://www.bn2vs.com Don't panic. Don't be evil. --