Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
PHP bindec() Function
Definition and Usage
The bindec() function returns decinmal equivalent of a binary number represented as a string argument. Binary number inside string is interpreted as unigned integer.
This function returns a decimal integer. However, it may return float for size reasons.
Syntax
bindec ( string $binary_string ) : number
Parameters
| Sr.No | Parameter & Description |
|---|---|
| 1 |
binary_string A string containing binary number representation. Invalid characters (other than 1 and 0) are ignored. |
Return Values
PHP bindec() function returns decimal equivalent of given binary number inside string.
PHP Version
This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.
Example
<?php
$arg='-1111';
$val=bindec($arg);
echo "bindec('" . $arg . "') = " . $val;
?>
Output
This will produce following result −
bindec('-1111') = 15 Advertisements
