<?php declare(strict_types=1); // pad on the left to width 3 echo str_pad("7", 3, "0", STR_PAD_LEFT), "\n"; // pad on both sides echo str_pad("hi", 6, ".", STR_PAD_BOTH), "\n";
str_pad with a direction flag