Home >Backend Development >PHP Problem >Correct use of decbin() function in PHP

Correct use of decbin() function in PHP

autoload
autoloadOriginal
2021-04-22 11:28:022344browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn