Using the PHP Function Decbin and Bindec to Convert Numbers
When working with numbers it is sometimes necessary to convert them from one base system to another. This can be done manually depending on the size of the number but it can be easier to use some built in PHP functions to perform this conversion for you. These include decbin(), bindec(), decoct(), hexdec() and base_convert().
The function decbin() takes a decimal formatted number and returns a string which contains the binary equivalent of that number. The counterpart function bindec() does the opposite and converts a binary number into a decimal formatted number.
Using these PHP functions can make the process of converting numbers much easier for you and you can also take advantage of some of the other built in functions that are available to you as well. These functions can be a huge time saver and they can also help you to work with numbers in a more organized way.
A good place to start is by learning about the different types of math functions that are built into PHP. There are a lot of them and they do a wide range of things but the most important thing to remember is that every operation has a certain precedence meaning that certain operations will always be performed before others. This includes multiplication and division which are always done before addition and subtraction. It also means that expressions inside parentheses are executed first.