I'm sure this is simple.. but...
$number1 = 0000 $number2 = 1
How do I return 0001, NOT 1
$number1 is pulled from a form, so can be ANY number, but I want 0000, 1000,2000 etc to work as above..
Thanks 🙂
echo $number1.$number2; //or to create a new var $v=$number1.$number2;
wouldn't that return:
00001 not 0001 (not the extra 0)
or 80001 instead of 8001 (again extra 0)
???
That's a combination of adding numbers and formating strings.
$num = sprintf('%04d', $number1 + $number2);
sorry, didn't count the 0's
just for an alternative:
$num = substr($number1,0,-1) . $number2;
Thanks.. working well with solution from johanafm
Cheers 🙂