The .NET convert class is a great help when you need to convert numbers between different systems. Here's how you can convert a decimal into a binary in one line:
$number = 12756576
The toString() method takes your number and the base you would like to use. For binary representation, choose base 2. To convert to hexadecimal, use 16:
The opposite works, too. Use this approach to convert a binary to a decimal:
$binary = '1110111000010001'