bindec
Returns the decimal equivalent of the binary number represented by the binary_string argument.
bindec converts a binary number to an int or, if needed for size reasons, float.
bindec interprets all binary_string values as unsigned integers. This is because bindec sees the most significant bit as another order of magnitude rather than as the sign bit.
Parameters
- binary_string
-
The binary string to convert. Any invalid characters in binary_string are silently ignored. As of PHP 7.4.0 supplying any invalid characters is deprecated.
Warning:
The parameter must be a string. Using other data types will produce unexpected results.
Return Values
The decimal value of binary_string
Notes
Note:
The function can convert numbers that are too large to fit into the platforms int type, larger values are returned as float in that case.
Changelog
Version | Description |
7.4.0 | Passing invalid characters will now generate a deprecation notice. The result will still be computed as if the invalid characters did not exist. |