PHP decbin() Function
Definition
The decbin()
function converts a decimal number into a binary number.
Syntax
PHP decbin() Function has the following format.
string decbin ( int num )
Parameter
Parameter | Is Required | Description |
---|---|---|
num | Required. | Decimal value to convert |
Return
Item | Description |
---|---|
Return Value | A string that contains the binary number of the decimal value |
Return Type | String |
Example
Converts a decimal number into a binary number
<?PHP//from ww w . j a v a2 s .c om
print decbin(16); // "10000"
echo decbin("3") . "\n";
echo decbin("1") . "\n";
echo decbin("15") . "\n";
echo decbin("7");
?>
The code above generates the following result.