PHP String

Last Updated: August 28, 2021

Padding String in PHP

echo str_pad($i, 2, "0", STR_PAD_LEFT); 

If $i=9 then you can get output 02. Similarly, you can do the right padding with STR_PAD_RIGHT