Edit report at http://bugs.php.net/bug.php?id=47418&edit=1
ID: 47418 Comment by: Reported by: cu19 at gmx dot de Summary: number_format misbehaving with some values Status: No Feedback Type: Bug Package: *Math Functions Operating System: Win7 PHP Version: 5.3.1 New Comment: did you ever get my email? Previous Comments: ------------------------------------------------------------------------ [2010-02-20 01:00:00] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2010-02-12 23:01:50] tdietsche at comcast dot net pajoye: I have just sent you an email with an attached zip, please reply here or to my email to confirm that you received it, thanks. ------------------------------------------------------------------------ [2010-02-12 19:10:55] tdietsche at comcast dot net Yes, I will do that and email you a link. The information is confidential so I must first remove people's personal information first (names etc). Please remove the file when you are done with it. ------------------------------------------------------------------------ [2010-02-12 14:18:15] paj...@php.net It could be an encoding issue then (before it gets formatted). Can you zip the script and the excel file you use and post a link to it here? Or drop me a mail. ------------------------------------------------------------------------ [2010-02-12 14:15:30] tdietsche at comcast dot net I am not sure what you mean by "isolate the value which causes problems and pass it directly to number_format". If I just assign 19 to a variable (either as a string or as a number) and do this, it works fine. It is only when it comes from a result row value of a number-formatted excel spreadsheet cell that it shows the problem, for me. You could try a much simpler spreadsheet but I gave all the details of the one I am using that shows the problem, in case for some reason the spreadsheet details are related somehow (probably not though). I don't have time to install a new version of php right now, maybe later. I have already spent more time on this than I can afford. One other note, I see in playing around I changed some variable names in one function, it should really read: function FmtAmt($amt) { // another workaround for the total if ((string)$amt == '18.:') $amt = '19'; $cred = ' '; if ($amt < 0) { $amt = 0 - $amt; $cred = 'CR'; } // uncomment this and comment out next line to see bug // $ret = number_format($amt, 2) . $cred; $ret = stupid_php($amt) . $cred; return $ret; } ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=47418 -- Edit this bug report at http://bugs.php.net/bug.php?id=47418&edit=1