Powered by Blogger.

How PHP output fixed length string


How PHP output fixed-length string? For some format control, you may want a specified length string in PHP.
Just use the following code:
echo str_pad($str, 25, 'X', STR_PAD_LEFT);

No comments