我如何爆炸一个整数 [英] How do I explode an integer
问题描述
这个问题的答案很简单.但我对编程很陌生.所以要温柔...
the answer to this could be easy. But I'm very fresh to programming. So be gentle...
我正在努力为您的一位客户快速解决问题.我想得到一个整数中的总位数,然后将整数分解:
I'm at work trying to do a quick fix for one of your customers. I want to get the total numbers of digits in a integer, and then explode the integer:
rx_freq = 1331000000 ( = 10 )
$array[0] = 1
$array[1] = 3
.
.
$array[9] = 0
rx_freq = 990909099 ( = 9 )
$array[0] = 9
$array[1] = 9
.
.
$array[8] = 9
我不能使用explode,因为这个函数需要一个分隔符.我已经搜索过以前的 Google 和 Stackoverflow.
I'm not able to use explode, as this function need a delimiter. I've searched the eyh'old Google and Stackoverflow.
基本上:如何在没有分隔符的情况下分解整数,以及如何找到整数中的位数.
Basically: How do I explode an integer without delimiter, and how do I find the number of digits in an integer.
推荐答案
$array = str_split($int)
和 $num_digits = strlen($int)
应该可以工作就好了.
$array = str_split($int)
and $num_digits = strlen($int)
should work just fine.
这篇关于我如何爆炸一个整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!