1. Home
  2. Computing & Technology
  3. PHP / MySQL

Decbin () PHP Function

By Angela Bradley, About.com

Definition: The Decbin () PHP Function is used to convert a decimal into a binary number. This is the opposite of Bindec () which is used to convert a binary number into a decimal.
Also Known As: Decimal to Binary
Examples:
<?php
echo(decbin(1) . "<br />");
echo(decbin(100) . "<br />");
echo(decbin(12) . "<br />");
echo(decbin(3453) . "<br />");
?>
This returns the following binary:
1
1100100
1100
110101111101
Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. Decbin PHP Function - Convert a decimal into Binary

©2009 About.com, a part of The New York Times Company.

All rights reserved.