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

PHP整数到浮点值

The database I am working with has price value as 1500 which is 15.00 or 2000 which is 20.00. The right two number will be floating decimals. Is there any PHP function to convert this kind of integer values 1500 to floating values 15.00?

Thanks in advance

One way to do it would be by using

number_format

like

number_format($price/100,2,'.',',');

where $price is the price.

近期文章

  • *无法打开vchiq实例
  • 用PHP解释JavaScript
  • 应该如何删除else块
  • 表单HTML5和PHP&Javascript选项卡
  • 按钮内的HTML-HREF标签
  • 缩短PHP代码的诀窍? [关闭]
  • 会话变量不粘
  • 从复选框创建一个数组
  • 使用foreach插入值JSON?
  • Preg_replace图像内部样式[重复]
  • 从Json Encode中删除名称
  • Echo foreach循环内部数组[关闭]
  • PHP - mysql_query返回0行
  • 构造函数与静态实例
  • PHP测验将数据发送到下一页
  • 动态改变形式动作?
  • 我服务器上的文件在哪里?
  • 需要一些XML解析方面的帮助
  • 在数据库mysql中保存图像
  • 混合PHP Echo和Javascript [关闭]

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华