Welcome to the Linux community forum and interact with 2 million technicians. The str_pad () function of php fills the string with the specified length, which is similar to str_repeat, the usage of str_repeat is not explained here. If you are interested, you can find the manual. syntax str_pad (string, length, pad_string, pad_type) parameter description stri
Welcome to the Linux community forum and interact with 2 million technicians> the str_pad () function in php fills the string with the specified length, which is similar to str_repeat, the usage of str_repeat is not explained here. If you are interested, you can find the manual. syntax str_pad (string, length, pad_string, pad_type) parameter description stri
Welcome to the Linux community forum and interact with 2 million technicians>
The str_pad () function of php fills the string with the specified length, which is similar to str_repeat. The usage of str_repeat is not explained here. If you are interested, you can find the manual.
Syntax
Str_pad (string, length, pad_string, pad_type)
Parameter description
String is required. Specifies the string to be filled.
Length is required. Specify the length of the new string. If the value is smaller than the length of the original string, no operation is performed.
Pad_string is optional. The specified string for filling. The default value is blank.
Pad_type is optional. Specify the other side of the string to be filled.
Possible values:
STR_PAD_BOTH-fill in the two ends of the string. If it is not an even number, the right side will receive additional filling.
STR_PAD_LEFT-fill in the left side of the string.
STR_PAD_RIGHT-fill in the string to the right. This is the default one.
Example 1
Output:
Hello World .........
Example 2
Output:
... Hello World
Example 3
Output:
...: Hello World .:.:.