1. Computing & Technology

Discuss in my forum

Bindec () PHP Function

By , About.com Guide

Definition: The Bindec () PHP function is used to convert a binary string into a decimal. In Bindec (x) the input x would be the binary string. If you aren't sure if a string is a binary number you can check it using the Isbinary () function.
Examples:
 <?php 
 echo(bindec(10) . "<br />"); 
 echo(bindec(1001010) . "<br />"); 
 echo(bindec(111) . "<br />"); 
 echo(-bindec(1011101) . "<br />"); 
 ?> 

This will return:
2
74
7
-93

©2012 About.com. All rights reserved.

A part of The New York Times Company.