我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

使用PHP的长浮点数

I have the number 2.23456789, I want to get it only 2.23 by using PHP,but I do not know how to do this, anyone help me please,Thanks.

You could use the round(value,precision) function. In your case, use:

round(2.23456789,2);

For further information check the PHP manual: http://php.net/manual/en/function.round.php

You simply want to round the number.

Use phps number_format function.

近期文章

  • 记事本到VIM复制/粘贴代码[关闭]
  • PHP语法错误,意外';' [关闭]
  • 重定向没有index.php的URL [重复]
  • 按表格更新数据库[关闭]
  • 如何将CSS类或ID挂钩到PHP中的元素[关闭]
  • 查找日期是未来还是不[关闭]
  • 功能mail()[关闭]
  • 如果存在,Php重定向到变量
  • 在第4行'ORDER BY date DESC LIMIT 1'附近使用的正确语法[关闭]
  • 将PHP传递给Javascript [关闭]
  • var_dump to string [关闭]
  • 非法字符串偏移,如何使用此数据[关闭]
  • 如何在php或javascript中为数字着色[关闭]
  • 什么是正确的PDO语法[重复]
  • 如何找到x2和y2 [关闭]
  • 从MYSQL表中提取没有时间的日期[复制]
  • 将一些文字发布到??? 监控[关闭]
  • Javascript相当于PHP代码
  • 解析错误:语法错误,第3行意外T_STRING [关闭]
  • 将RedBean ORM集成到Zend Framework中[关闭]

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华