Get the App
SLTechnology News&Howtos  ›  Development  › 

How php converts numbers to binary

Shulou Source: shulou.com Published: 2022-06-03 07:36:04 09月13日 Update

Today, I will talk to you about how php converts numbers into binary, which may not be well understood by many people. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Php converts numbers into binary: 1, use decbin () function, syntax "decbin"; 2, use base_convert () function, syntax "bindec (numbers, 10,2)".

Tutorial operating environment: windows7 system, PHP7.1 version, DELL G3 computer

Php converts numbers (decimal) to binary

1. Use the decbin () function

The decbin () function converts decimal numbers to binary numbers.

Output result:

11111000110011111

2. Use the base_convert () function

The base_convert () function can be converted between any binary, as long as you set "bindec (number, 10,2)".

Output result:

10110111101000111

After reading the above, do you have any further understanding of how php converts numbers to binary? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Numbers functions binary content decimal results grammar decimal output between just need tutorials methods more environment computer knowledge articles systems industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft NVidia Shulou Tech Info Huawei MariaDB