Monday, May 14, 2012

Number/Money Format woes with PHP 5.3

PHP upgrade caused problems with number_format
Message: E_WARNING Caught: number_format() expects parameter 1 to be
double, string given in /srv/www/vhosts/class.inc on line 2383

replaced

"$" . number_format($_wo["expense_total",2);

with good ol'

sprintf("$%01.2f", $_wo["expense_total"]);

No comments: