Str_pad
(PHP4 >= 4.0.1)
Str_pad---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; The padding string becomes the specified length
Syntax: string str_pad (string input, int pad_length [, string pad_string [, int pad_type]])
Description:
This function is padded to the left, right, or left and right of the string parameter input to become the specified padding length. If the pad_string option is not provided, the parameter input is padded with white space, otherwise it is padded to the specified length using pad_string.
Non-required options pad_type can be str_pad_right, str_pad_left, or Str_pad_both, and if Pad_type is not specified, it is assumed to be str_pad_right.
If the value of the pad_length is a negative number or is less than the length of the input string, it is not padded.
Example:
<?php
$input = "Alien";
Print Str_pad ($input, 10); Produces "Alien"
Print Str_pad ($input, ten, "=", str_pad_left); Produces "-=-=-alien"
Print Str_pad ($input, "_", Str_pad_both); Produces "__alien___"
?>