bindec

int bindec(string binary_number) 

Returns a decimal representation of the binary string passed to it.

Returns:

Decimal integer form of a binary number

Description:

Converts the binary string given by binary_number into its decimal form. The largest decimal value that can be converted is 2147483647, which should be enough for most people.

Version:

PHP 3, PHP 4

See also:

base_convert() 
dechex() 
decbin() 
decoct() 
hexdec() 
octdec() 

Example:

Convert a binary number to decimal
$number = "101010"; 
echo "Binary $number is ", bindec($number), "in decimal"; 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.