How can I convert such an ID to a group of ID strings like 10 & nbsp; 101010122233 I want to convert to the following integer number 100000000001010000000010122233000, how can I write it. It is best to have a method. ------ Solution -------------------- str_pad --- Help: how can I convert such an ID?
A group of ID strings like me
10
1010
10122233
I want to convert it to the integer below
10 000 000 000
10 100 000
10 122 233
How can I write such an algorithm.
It is best to have a method.
------ Solution --------------------
Str_pad
------ Solution --------------------
$ S = '000000 ';
$ S = str_pad ($ s, 11, '0 ');
$ T = number_format ($ s );
Echo join ('', explode (',', $ t ));
------ Solution --------------------
PHP code
$ Str1 = '10'; $ str2 = '000000'; $ str3 = '000000 '; // 10 000 000 000 // 10 100 000 000 000 // 10 122 233 000 echo str_pad ($ str1, 11, '0 ').'
'; Echo str_pad ($ str2, 11, '0 ').'
'; Echo str_pad ($ str3, 11, '0 ').'
';
------ Solution --------------------
Str_pad (string, length, pad_string, pad_type) // The str_pad () function fills the string with the specified length.