Home  >  Article  >  Backend Development  >  小弟我这样的ID如何转换

小弟我这样的ID如何转换

WBOY
WBOYOriginal
2016-06-13 10:34:36731browse

求助:我这样的ID怎么转换
我这这样的一组ID字符串
10  
1010
10122233



我想转换成 下面的整型数

10 000 000 000
10 100 000 000
10 122 233 000


请问一下,这样的算法,我怎么写一下。
最好是有一个方法。

------解决方案--------------------
str_pad
------解决方案--------------------
$s = '10122233';
$s = str_pad($s, 11, '0');
$t = number_format($s);
echo join(' ', explode(',', $t));
------解决方案--------------------

PHP code
$str1='10';$str2='1010';$str3='10122233';//10 000 000 000//10 100 000 000//10 122 233 000echo str_pad($str1, 11,'0').'<br>';echo str_pad($str2, 11,'0').'<br>';echo str_pad($str3, 11,'0').'<br>';<br><font color="#e78608">------解决方案--------------------</font><br>str_pad(string,length,pad_string,pad_type)//str_pad() 函数把字符串填充为指定的长度。<div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn