PHP free example: How to pad a string with another string?

By: Anton, NetArt Media
Tue, 17 August 2021
PHP free example: How to pad a string with another string?

You may use the special PHP function str_pad

<?php

echo str_pad("Marco", 10, ">", STR_PAD_LEFT);

?>

will display:

>>>>>Marco


Category: PHP Examples
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox