开发者

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

开发者 https://www.devze.com 2023-03-25 22:06 出处:网络
I have a number like this: 12345678987654321 I want to only use the first 5 digits like this: 123开发者_JS百科45

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

精彩评论

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