Pad String End

Pad a string from the end with a specified character to reach a target length.

Code

General
str_pad($str, $length, $char, STR_PAD_RIGHT);

Parameters

The string to pad

Target length of the result

Character to pad with

Server

More PHP Snippets