All Functions

rightpad - Right Padding

This method adds padding characters to the end of a string until it reaches a certain lenght.

You can define the length of the string and the padding to be used.

Usage(s)

rightpad ( $subject , $length , $padding ) Returns the string $subject with length length padded with $padding characters

Parameter(s)

$subject The string (or number) to be lengthened
$length the length of the target string after adding padding
$padding

The string to be added to the subject as padding

Note: If the padding string is longer than one character, the length of the target string can become larger than $length

Example(s)

Right Padding Example

rightpad(123,6,*)
Returns: 123***

rightpad(leftpadding is 1337,100,!)
Returns: rightpadding is 1337!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

See also

truncate - truncate string length replace - string replace leftpad - Left Padding