Pad a string to a certain length with another string
str_pad ( string $input , int $pad_length [, string $pad_string = " " [, int $pad_type = STR_PAD_RIGHT ]] ) : string
<?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, "___"); // produces "Alien_" echo str_pad($input, 3, "*"); // produces "Alien" ?>
string(10) "Alien " string(10) "-=-=-Alien" string(10) "__Alien___" string(6) "Alien_" string(5) "Alien"
#leadingzero #pad #string #strpad