Convert binary to decimal:
<?phpecho bindec("0011") . "<br>";echo bindec("01") . "<br>";echo bindec("11000110011") . "<br>";echo bindec("111" );?>The bindec() function converts a binary number to a decimal number.
Tip: To convert decimal to binary, check out the decbin() function.
bindec( binary_string );
parameter | describe |
---|---|
binary_string | Required. Specifies the binary string to be converted. Note: Parameter value must be a string! |
Return value: | The decimal value of binary_string . |
---|---|
Return type: | Float/Integer |
PHP version: | 4+ |