Make use of str_pad()'s optional parameters : str_pad « String « PHP






Make use of str_pad()'s optional parameters

 
<?
$header = "Table of Contents";
print str_pad ($header, 5, "=-", STR_PAD_BOTH);
?>
  
  








Related examples in the same category

1.str_pad() function pads string to length pad_length with a specified characters
2.str_pad-2.php
3.str_pad.php
4.string str_pad ( string input, int length [, string padding [, int type]] )
5.STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH:
6.There is an optional third parameter to str_pad( ) that lets you set the padding character to use
7.Using left space padding
8.Using left zero padding