I want format number as style '00000' ex:
$a=1 => $a2="00001"
$b=23 => $b2="00023"
How format number in php?
You should use str_pad : http://www.php.net/manual/fr/function.str-pad.php
$formattedValue = str_pad($value, 6, "0", STR_PAD_LEFT);
$formattedValue = sprintf('%05s', $value);
0
is the character to pad 5
times. s
specifies that it's a string.use the str_pad function:- $a2 = str_pad($a, 5, "0", STR_PAD_LEFT);