My code is:
$arr=[02,05,07,08,09];
print_r($arr)
and output is:
Array
(
[0] => 2
[1] => 5
[2] => 7
[3] => 0
[4] => 0
)
Why it converts 08
and 09
to 0
??
Numbers beginning with a zero are considered to be in base 8.
See PHP docs: Integers - Syntax.
To use octal notation, precede the number with a 0 (zero). To use hexadecimal notation precede the number with 0x. To use binary notation precede the number with 0b.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With