str_pad
Optional argument pad_type can be STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If pad_type is not specified it is assumed to be STR_PAD_RIGHT.
<?
php
$input
=
"
Alien
"
;
echo
str_pad
(
$input
,
10
);
//
produces "Alien "
echo
str_pad
(
$input
,
10
,
"
-=
"
,
STR_PAD_LEFT);
//
produces "-=-=-Alien"
echo
str_pad
(
$input
,
10
,
"
_
"
,
STR_PAD_BOTH);
//
produces "__Alien___"
echo
str_pad
(
$input
,
6
,
"
___
"
,
STR_PAD_RIGHT);
//
produces "Alien_"
echo
str_pad
(
$input
,
6
,
"
___
"
);
//
produces "Alien_"
?>