# Decimal + octal + hex, can someone explain this?

Hi, I am very new to PHP and I did a quiz with a question I couldn’t decipher. This question seem to deal with number types in relation to methods of organizing numbers and count (like the decimal method).

Can someone please further explain why the answeris 37 for newcommers like me?

Thanks,

Okay, so the first 11 is in decimal, or base 10, so it is as it reads, 11.

The second 11, shown as 011, is being interpreted as base 8, the first 1 counts as 8, plus the second 1, which counts as 1, which makes 9.

The last 11, shown as 0x11 is hexidecimal, or base 16. so the first 1 counts as 16, plus the second 1 which counts as 1, which makes 17.

Add 11, 9 and 17 together to get 37 as the total.

2 Likes

Maybe thinking in terms of binary (the common “root” the other types are derived from) would help?

``````00001011
+
00001001
+
00010001
=
00100101
``````
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.