Posted by Steve on 11/01/06 18:35
sorry, confusing reference to ternary operators. i was refering to my
original response to you in this thread. but to be even more clear, a
ternary takes this form:
$variable = <some condition> ? <return if condition is true> : <return if
false>;
ex;
$price = '';
$price = $price ? number_format($price, 2) : $price;
so if price were '' or 0, price would not change. however if price were
*anything* (even 'ABC'), then number_format(...) would have been called -
although 'ABC' would have make it yell at you via errors shown in your
browser output. ;^)
[Back to original message]
|