7 to 07
I'm running a script that intake 07 as valid number not 7.
How can I convert 7 to 07.
Thanks In advance,
$variable = "0$variable";
Maybe this post about adding zero's could also help.
you can also use
sprintf return the formatted string.
Please let me know "%02d" stands for ?
Originally Posted by priti
Originally Posted by newbizz
Look at example 7.
It adds zeroes in front of the variable, until it's at least two characters long. So '7' will become '07', and '07' would remain '07'.