Latest web development tutorials

PHP bindec () function

PHP Math Reference PHP Math Reference

Examples

Binary to decimal:

<?php
echo bindec("0011") . "<br>";
echo bindec("01") . "<br>";
echo bindec("11000110011") . "<br>";
echo bindec("111");
?>

Running instance »

Definition and Usage

bindec () function to convert a binary number to decimal.

Tip: To convert from decimal to binary, check decbin () function.


grammar

bindec( binary_string );

参数 描述
binary_string 必需。规定要转换的二进制字符串。
注释:
参数值必须是字符串!

technical details

return value: binary_string the decimal value.
Return type: Float / Integer
PHP version: 4+


PHP Math Reference PHP Math Reference