Reply to Re: not displaying null data when using number_format

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация