/**
* Fills a string into a string of a specified length (Multi-byte security)
* @param string $str to specify the character to be populated
* @param int $len Specifies the length of the filled string, if the value is negative or less than the length of the string is not populated
* @param string $pad _str to be populated
* @param int $pad _type Specifies the direction of the fill str_pad_right,str_pad_left or Str_pad_both
* @return String
*/
String Str_pad (string $str, int $len, String $pad _str, String $pad _type);
Echo Str_pad ($result 2[0],6, "0", str_pad_left);
Copy the Code code as follows:
$input = "Alien";
Echo Str_pad ($input, 10); Produces "Alien"
Echo Str_pad ($input, ten, "-=", str_pad_left); Produces "-=-=-alien"
Echo Str_pad ($input, Ten, "_", Str_pad_both); Produces "__alien___"
Echo Str_pad ($input, 6, "___"); Produces "Alien_"
?>
The above describes the string constants PHP Str_pad to fill the string into a specified length of string, including the string constants of the content, I hope to be interested in PHP tutorial friends helpful.