开发者

How would I trim a number to 5 digits in PHP?

I have a number like this:

12345678987654321

I want to only use the first 5 digits like this:

123开发者_JS百科45

How would I do that in PHP? number_format?


Something like substr($number, 0, 5); would suffice.


$num = "12345678987654321";
$num2 = substr($num, 0, 5);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜