Submitted: Jun 22 2012 / 15:08
For php younger than 5.3.5 the answer to:
php -r 'print number_format("",0) . "\n";'
is NULL and a message:
PHP Warning: number_format() expects parameter 1 to be double, string given in Command line code on line 1
Now I have tried the floatval function, which return 0 on empty string and casting, which also return 0 on empty string.
I suggest that the 'number_format' function uses floatval on a string, for the sake of consistency.
Note1: Python 3+ does not like empty strings and throws an error.
Note2: Perl, the father of PHP, doesn't care.
Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.