PHP Str_Pad() Function Pads String To Length Pad_Length With Specified Characters – String Function

 
Its syntax is: string str_pad (string input, int pad_length [, string pad_string [, int pad_type]])If pad_string is not specified, string will be padded with blank spaces. pad_type may be assigned STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTHThis example shows how to pad a string using str_pad() defaults:
<?
$food = "salad";
print str_pad ($food, 5);
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.