NYCPHP Meetup

NYPHP.org

[nycphp-talk] How to return a calculated result or zero

Cliff Hirsch cliff at pinestream.com
Tue Jan 31 18:19:44 EST 2006


I know, I am making something out of nothing. The only real issue I see
is that the calculation is performed twice. If we pull the calc out, it
will only be performed once, but than we have an extra temp variable.

-----Original Message-----
From: On Behalf Of Carlos A Hoyos

Sorry to nit-pick, but why is this one so ugly? I might come from the
"c" school, but I honestly find

$result = ($calculation > 0) ? $calculation : 0;

easy to read (and a little sexy too).




More information about the talk mailing list