You can use str_pad to do this.
$number = "1234567";
$number = str_pad($number, 8, "0", STR_PAD_LEFT);
echo $number;
As long as your number is less than 8 digits, it will append 0s to it.
You can use str_pad to do this.
As long as your number is less than 8 digits, it will append 0s to it.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.