Padding a string
Padding strings: str_pad()
With str_pad()
function you can pad (fill with some characters) a string.
To pad a string with spaces until it reaches the length of ten chars:
The default is to pad with blank spaces " "
at the end of the original string.
If you need to change the default behaviour you have the third parameter to define the char for padding.
You can also define more chars for padding:
You can define the βdirectionβ of the pad with the constant STR_PAD_RIGHT
(the default) or STR_PAD_LEFT
or STR_PAD_BOTH
: