This is because all numbers starting with 0 are considered octal values ββthat have an upper limit of 8 digits per position (0-7). As indicated in the PHP manual , instead of silently discarding invalid numbers, they now (7.x) trigger the warning above.
Why are you writing your numbers like this? If the leading zeros are significant, then this is not the number you have, but a string. If you need to do calculations on them as if they were numbers, then you need to add leading zeros when outputting values ββto the client.
This can be done using printf()
or sprintf()
as follows:
$number = 5; printf ("%05$1d", $number);
Please see the manual for more examples .
source share