如何在php中显示/避免epsilon值

时间:2011-12-06 09:07:57

标签: php mysql

  

可能重复:
  Forcing output in standard mathematical notation in PHP

Output displayed: 2e+008  

如何避免在php中显示epsilon值?

Output needed: 200000000

mysql表

   amount   float

如果我在输入框中输入200000000,它会在mysql中存储2e + 008,并使用此代码通过jquery获取值

$amount=$("[id=amountfee]").val();

<?php echo $amount ?>

2 个答案:

答案 0 :(得分:0)

您应该查看number_format()函数:http://us2.php.net/manual/en/function.number-format.php

答案 1 :(得分:0)

使用DECIMAL或DOUBLE作为数据类型而不是float。这也可以帮助您避免浮动时可能出现的问题。