Convert binary to decimal in PHP
Question:
How to convert binary to decimal in PHP? Answer:
$binary = '1101100010010010';
$decimal = bindec($binary);
echo $binary . ' -> decimal value is: ' . $decimal;
Description:
The bindec
function returns the decimal equivalent of the binary number represented by the argument. It converts a binary number to an int or, if needed for size reasons, float.
Reference:
bindec function reference
Share "How to convert binary to decimal in PHP?"
Related snippets:
Tags:
convert binary to decimal, binary to decimal conversion, binary, decimal, conversion, casting Technical term:
Convert binary to decimal in PHP