10 Apr
2007
10 Apr
'07
9:41 a.m.
Its slightly off topic, buw while we are at it, I benchmarked if ($foo) {bar()} versus $foo ? bar () : null; Op dinsdag 10 april 2007 08:20, schreef Jakob Petsovits:
Just out of interest, what's with
if ($class !== 'even') { $class = 'odd'; }
if ($foo) { $bar } is about 7% faster then $foo ? $bar : null; The reason is, obviously, that the second always needs an else. And if() else statement is just as fast as the $foo? : ; way. We should avoid $foo ? checks that need no else at all costs, imo. Bèr