Paulo Coghi
Paulo Coghi

Reputation: 14959

PHP: Why the 'abs' function returns a wrong number if it begins with zero?

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!

Upvotes: 1

Views: 669

Answers (1)

DuoSRX
DuoSRX

Reputation: 4199

Numbers beginning by zero are interpreted as octal.

See php documentation.

Upvotes: 10

Related Questions