Re: number_format
| From: | Robert Cummings | Date: | Mon, 19 Dec 2011 16:38:43 +0000 |
| Subject: | Re: number_format | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316066@lists.php.net to get a copy of this message | ||
On 11-12-19 11:08 AM, Bastien Koert wrote:
On Mon, Dec 19, 2011 at 9:19 AM, Floyd Resler<fresler@adex-intl.com> wrote:Or possibly: <?php number_format( (float)$your_input, 2 ); ?> Cheers, Rob.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. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpCould you check it before formatting? Or if the data is coming from the db, force it to 0 if null? $var = (is_double($number_var)) ? $number_var : 0;
-- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized.