views:

105

answers:

1

The code "abs(070000)" returns 28672, but the code "abs(70000)" returns 70000.

Did the zero at the beginning means that the number is interpreted as hex?

Thank you!

+9  A: 

Numbers beginning by zero are interpreted as octal.

See php documentation.

DuoSRX
If I compare two numbers, one in decimal and the other in octal, does the comparison will be done correctly?
Paulocoghi
Like "if(a < b)", but a is octal and b is decimal.
Paulocoghi
Ok ok... now I understand. This comparison will be done the wrong way, because the number has changed its base.Thank you!
Paulocoghi
I'm removing the beginning's zeros with the function 'ltrim($string_of_numbers,"0")'. [SOLVED]
Paulocoghi