I want format number as style ‘00000’ ex:
$a=1 => $a2="00001" $b=23 => $b2="00023"
How format number in php?
Advertisement
Answer
You should use str_pad : https://www.php.net/manual/en/function.str-pad.php
$formattedValue = str_pad($value, 6, "0", STR_PAD_LEFT);