Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMissy Kailet
4,475 PointsWhat does "b" in a binary number mean?
There are a few examples of different bases within the current lesson. Binary numbers are of base 2, or 0's and 1's...so, with that said, what does the letter "b" mean within the following statement? Has it always been supported, or is this something new?
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! It's a way to denote to PHP that this number is a binary number. Otherwise, it's going to think it's a normal decimal number. The same goes for octal and hexadecimal. The numbers rely on different prefixes to denote that they should be calculated as something other than base 10 numbers. You can find the documentation here.
Hope this helps!
edited for additional note
As I understand it, while binary numbers were supported in previous versions of PHP, this particular way of denoting a binary number came about as of version 5.4.0. We're currently on version PHP 7, so I don't think I'd call it new.
Missy Kailet
4,475 PointsMissy Kailet
4,475 PointsI didn't realize that the binary number was just the portion with 11111111 (as well as the 123 in front of the octal) until this answer. Thanks!