Str_pad function
Syntax:
string str_pad ( string input, int pad_length [, string pad_string [, int pad_type]])
str_pad function is used to pad a string to specific length with another string.
Example:
<?php
$username = “sampleuser”;
echo str_pad($username,18,’*',STR_PAD_BOTH);
?>
In above example, First parameter $username is input string. Second parameter 18 is pad length. Third parameter * is the pad string which is optional. Default pad string is space. Fourth parameter STR_PAD_BOTH is pad type which will pad string on both sides. Default pad type is STR_PAD_RIGHT.
