Home >Backend Development >PHP Problem >Correct use of decbin() function in PHP
In people’s daily use, decimal is used, while the bottom layer of the computer uses binary. So what if we use PHP
How to solve the problem of converting decimal to binary? This article will take you to take a look.
First let’s take a look at the syntax of the decbin() function
decbin ( int $number )
$number: the number to be converted
Return value: a string containing the binary representation of the given $number parameter. The maximum value that can be converted is decimal 4294967295
, and the result is a string of 32
1’s .
Code example:
<?php echo decbin(6) . "<br>"; echo decbin(4294967295),"<br>";
输出:110 11111111111111111111111111111111
Recommendation: 《2021 PHP Interview Questions Summary (Collection) 》《php video tutorial》
The above is the detailed content of Correct use of decbin() function in PHP. For more information, please follow other related articles on the PHP Chinese website!