PHP bindec() - Math Functions

What is bindec Function?
How to convert binary number to deciaml in PHP?

Explanation

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

Syntax:


bindec(binary_number)

In the above syntax "binary_number" is the binary number to be converted to decimal.

Example :


<?php
echo bindec("0011") . "<br />";
echo bindec("01") . "<br />";
?>
Result :

3
1

In the above example, the binary numbers "0011", "01" are converted to decimal numbers "3","1".

PHP Topics


Ask Questions

Ask Question