Quoting Floyd Resler <fres...@adex-intl.com>:

In the previous version of PHP we were using, I could pass a string to number_format and it would just change it to a 0 without complaint. With 5.3.6 I get an "expects double" error. I don't suppose there's a way to make it work like it used to??? I'm dealing with really old code that wasn't very well structured.

The way I would get around this would be to create a function like this:

function my_number_format($number, $decimals = 0, $dec_point = '.', $thousands_sep = ',') {
   $number += 0;  //convert value to a number.
   return number_format($number, $decimals, $dec_point, $thousands_sep);

The just do a global replace of number_format with my_number_format.

That should work, although I haven't tested it...


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to