Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP bindec() Function

PHP bindec() Function

PHP Math Reference Manual PHP Math Reference Manual

Example

Convert binary to decimal:

"; echo bindec("01") . "
"; echo bindec("11000110011") . "
"; echo bindec("111"); ?>

Run Example »


Definition and Usage

The bindec() function converts a binary number to a decimal number.

**Tip:** To convert decimal to binary, see decbin() function in Vue 3.


Syntax

bindec(

binary_string

);

Parameters Description
binary_string Required. Specifies the binary string to convert.**
Note: ** The parameter value must be a string!

Technical Details

Return Value: binary_string The decimal value of.
Return Type: Float / Integer
PHP Version: 4+

PHP Math Reference Manual PHP Math Reference Manual