RE: Problem with wanting something NOT to round

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> George Pitcher wrote:
> >> Are you sure the web service is giving you 160.44? I get it
> displayed as
> >> expected...
> >>
> >>     http://dev.stut.net/php/pitcher.php
> >>
> > Yes, I am echoing the 160.44 ok. I'm just not getting the 44c
> in my display
> > price. I'm on Windows NT - could that be a factor?
>
> I'm not sure what you mean by "in my display price". Please elaborate?
>
If I paste your code (from your web-page example), into a new php file, I
get 160.44. However, replacing my existing code with the example code into
the page that is to  do the work, I get 160.00.

To simplify things, I've now done the following in the new php file and then
on my page:

$fee = 160.44;
echo "fee: ".$fee."<br>";
$fee2 = $fee + 0.00;
echo "fee2: ".$fee2."<br>";

I get 160.44 on the standalone page and 160.00 on my web page.

I am using PHP5.1 with Smarty templates on my page (but not on the
standalone page).

Smarty doesn't offer anything other than the sprintf() options for string
formatting of decimal numbers, and I'm already doing that.

Do you think Smarty could be so unsmart as to undo the formatting?

As another test, I did settype($fee2, "float")then the gettype($fee2) and
got 'float' on the standalone page and NULL on my Smarty page.

Truly stumped!

George

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux