Grammar
Str_pad (String,length,pad_string,pad_type)
Parameter description
string is required. Specifies the string to populate.
Length required. Specifies the length of the new string. If the value is less than the length of the original string, no action is made.
Pad_string is optional. Specifies the string to use for padding. The default is blank.
Pad_type is optional. Specify the padding string over there.
Possible values:
Str_pad_both-Fills the two ends of the string. If it is not an even number, the right side gets an extra fill.
Str_pad_left-fills the left side of the string.
Str_pad_right-fills the right side of the string. This is the default.
Example 1
Output:
Hello world .....
Example 2
Output:
......... Hello World
Example 3
Output:
.:.: Hello World..:.
http://www.bkjia.com/PHPjc/320299.html www.bkjia.com true http://www.bkjia.com/PHPjc/320299.html techarticle The Syntax Str_pad (string,length,pad_string,pad_type) parameter describes the string required. Specifies the string to populate. Length required. Specifies the length of the new string. If the value is less than the original word ...