str_pad
string str_pad(string string, int length, [string pad_string] [int pad_end])
string | String to be padded |
length | Desired string length |
pad_string | String to use for padding |
pad_end | Flag that controls whether right, left, or both ends of the string are padded |
Pads a string with arbitrary characters.
Returns:
String; NULL on error
Description:
str_pad() is used to pad a string to length length using the characters in pad_string . If pad_string is not specified, spaces are used.
When more than one character is used for pad_string , the padding is generated by repeating the pad_string from left to right until the desired length is reached. Any extra characters are truncated.
If the amount of padding specified is less than the length ...
Get PHP Functions Essential Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.