当前位置:网站首页>php 格式化数字
php 格式化数字
2022-04-21 06:38:00 【Mars慕容】
protected function float_number($number){
$length = strlen($number); //数字长度
if($length > 8){ //亿单位
$str = substr_replace(strstr($number,substr($number,-7),' '),'.',-1,0)."亿";
}elseif($length >4){ //万单位
//截取前俩为
$str = substr_replace(strstr($number,substr($number,-3),' '),'.',-1,0)."万";
}else{
return $number;
}
return $str;
}
版权声明
本文为[Mars慕容]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_38324424/article/details/106851389
边栏推荐
- 解释器模式(3.7-3.13)
- .net core 部署至Linux平台上访问SQL SERVER 2008 R2时提示连接超时异常
- PHP 对象转数组
- When deploying. Net core on Linux platform to access SQL Server 2008 R2, it prompts the connection timeout exception
- 2022-1-3至2022-1-16 访问者模式
- window 系统丢失北京时区解决方案
- leetcode 206.反转链表
- 批量压缩文件夹里的sql备份bak为rar,然后删除3天之前的rar
- 关于数据治理平台中数据仓库ODS、DW和DM概念理解
- Outh2的基本概念
猜你喜欢

PLSQL developer 14 installation details

Dip image smoothing

在vscode 中安装go插件并配置go环境以运行go

2022-1-3至2022-1-16 访问者模式

Leetcode 1423.可获得的最大点数(Maximum Points You Can Obtain from Cards)

解释器模式(3.7-3.13)

Login interface universal password bypass

【C#】文件操作

pip list 中已有的模块为什么没法在新project中使用,已解决

论文阅读:Measuring the Impact of a Successful DDoS Attack on the Customer Behaviour of Managed DNS Servi
随机推荐
Mini examination system v1 Version 0.0
PLSQL14软件包下载、汉化、注册
PLSQL developer 14 installation details
论文阅读:Domain Name Encryption Is Not Enough: Privacy Leakage via IP-based Website Fingerprinting
服务器和客户端的套接字通信
(2022.1.31-2022.2.14)模板模式解析
音乐 下载 等文件名都变成了相同的名字的解决方法
Creating Oracle database in Navicat tool
window 系统丢失北京时区解决方案
Navicat连Oracle报错[No matching authentication protocol]
浏览器跨域问题小结
pycharm 最新导入PIL库的方法
论文阅读:Measuring the Impact of a Successful DDoS Attack on the Customer Behaviour of Managed DNS Servi
db2相关操作知识点积累及WINDOWS环境DB2连接远程数据库实例
laravel 打印sql
論文閱讀:Measuring the Impact of a Successful DDoS Attack on the Customer Behaviour of Managed DNS Servi
sqlmap post 注入方法
leetcode 209. 长度最小的子数组
Panic and Recover
Slice upload solves the problem of single file upload