The decbin()
function converts a decimal number into a binary number.
PHP decbin() Function has the following format.
string decbin ( int num )
Parameter | Is Required | Description |
---|---|---|
num | Required. | Decimal value to convert |
Item | Description |
---|---|
Return Value | A string that contains the binary number of the decimal value |
Return Type | String |
Converts a decimal number into a binary number
<?PHP
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.