How can I convert an ID like me?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.