php - 如何在 PHP 中将数字修剪为 5 位数字?

标签 php trim number-formatting

我有一个这样的数字:

12345678987654321

我只想像这样使用前 5 位数字:
12345

我将如何在 PHP 中做到这一点? number_format ?

最佳答案

substr($number, 0, 5); 这样的东西就足够了。

关于php - 如何在 PHP 中将数字修剪为 5 位数字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6935221/

相关文章:

php - 是否有 Google Plus 评论插件? (比如 Facebook 社交评论、DISQUS 或 IntenseDebate)?

sql - 在 Oracle 中的字符串中修剪空格(新行和制表符空间)

c# - 来自字节数组的字符串不会在 C# 中被修剪?

excel - Excel中的数字格式

javascript - PHP -> jQuery -> AJAX 表单验证

php - 从 HTTP 自动切换到 HTTPS 的最佳实践是什么

sql - 如何从数组中删除空间 (powershell)

Javascript - 获取非常大的数字作为包含所有数字的字符串

iOS13 : NumberFormatter missing groupingSeparator when try to format 4 digits numbers with es_ES locale

php - 在 mysql 查询中强制计数为零