Question : add leading zeros in php
Answered by : itchy-iguana-hxd9gtwnchg0
$number = 4;
echo(str_pad($number, 2, '0', STR_PAD_LEFT)); // returns 04
$number = 14;
echo(str_pad($number, 2, '0', STR_PAD_LEFT)); // returns 14
Source : | Last Update : Wed, 09 Feb 22
Question : format a number with leading zeros in php
Answered by : tushar-saha
sprintf('%06d', '12')
Source : https://stackoverflow.com/questions/1699958/formatting-a-number-with-leading-zeros-in-php | Last Update : Wed, 10 Mar 21