: This article describes how to add a fixed number of PHP numbers to 0. For more information about PHP tutorials, see. When processing order numbers, a fixed number is required. for example, a fixed four-digit format is required:
1-> 000156-> 0056288-> 02881992-> 1992
You can use the php built-in function str_pad () to fill the string with a new length.
Str_pad (string, length, pad_string, pad_type) // The parameter description string // required. Specifies the string to be filled. Length // required. Specify the length of the new string. If the value is smaller than the original length of the string, no operation is performed. Pad_string // optional. The specified string for filling. The default value is blank. Pad_type // optional. Specifies the side of the string to be filled. // Possible value: STR_PAD_BOTH-// fill both sides of the string. If it is not an even number, the right side will receive additional filling. STR_PAD_LEFT-// fill the left side of the string. STR_PAD_RIGHT-// fill the right side of the string. Default value.
Example:
$ Num= 128; $ num = str_pad ($ num, 4, "0", STR_PAD_LEFT); echo $ num;
Output
0128
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The above section introduces the PHP number plus 0 by zero fixed digits, including some content. I hope my friends who are interested in the PHP Tutorial will be helpful.