Search w3schools.com:

SHARE THIS PAGE

PHP decbin() Function


PHP Math Reference Complete PHP Math Reference

Definition and Usage

The decbin() function converts a decimal number to a binary number.

Syntax

decbin(dec_number)

Parameter Description
dec_number Required. Specifies the decimal number to convert


Example

<?php
echo decbin("3") . "<br />";
echo decbin("1") . "<br />";
echo decbin("1587") . "<br />";
echo decbin("7");
?>

The output of the code above will be:

11
1
11000110011
111


PHP Math Reference Complete PHP Math Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]