String Str_pad (string, int pad_length, string pad_string, int pad_type);
String that specifies the length, pad_length, pad_string the string to fill (optional arguments), pad_type specifies the fill position (optional parameter, str_pad_left,str_pad_both);
If pad_string, Pad_type are empty, then the default pad_string is a space, and Pad_type is automatically populated at the end of the specified string.
Copy CodeThe code is as follows:
$string = "Test";
Echo Str_pad ($string, 10); Produces "test";
?>
The remaining two examples:
Copy CodeThe code is as follows:
$string = "Test";
Echo Str_pad ($string, ten, ' + ', str_pad_left); Produces "++++++test";
?>
Copy CodeThe code is as follows:
$string = "Test";
Echo Str_pad ($string, ten, ' + ', str_pad_both); Produces "+++test+++";
?>
http://www.bkjia.com/PHPjc/319831.html www.bkjia.com true http://www.bkjia.com/PHPjc/319831.html techarticle String str_pad (string, int pad_length, string pad_string, int pad_type), string specifies the length, pad_length is specified, pad_string is used to Filled string (optional parameter), Pad_type refers to ...