Decimal conversion to binary, octal, hexadecimal
From decimal to other binary conversions, the remainder is read by dividing the number by the number of binary numbers to be converted. Connected together on it.
Copy CodeThe code is as follows:
/**
PHP function Chapter Details decimal, binary, octal, and 16 conversion Functions description font: [Increase decrease] type: Reprint
Chinese character coding Research series The first, the PHP function of the decimal, binary, octal and
/**
* decimal-to-binary, octal, hex-less digits 0 *
*
* @param array $datalist incoming data array (100,123,130)
* The binary @param int $bin conversion can be: 2,8,16
* @return Array return data array () returns no data conversion format
*
How can we convert a piece of data into a hex format,
This is the data in a blob. now I use stream_get_contents to extract the data and convert it directly into the right-side ascii format in the graph, but it is not based on ascii in the protocol.
This article introduces in detail the application of decimal, binary, octal and 16 binary conversion functions in PHP, and the friends who need it can refer to the following.
One, decimal system conversion function description1, decimal to Binary
One, decimal system conversion function description1, decimal to Binary decbin () function, the following exampleEcho Decbin (12); Output 1100Echo Decbin (26); Output 11010Decbin(PHP 3, PHP 4, PHP 5)Decbin--decimal conversion into
The PHP binary conversion function is as follows:Bindec ()-Binary conversion to decimalDecbin ()-Decimal converts to binaryDechex ()-Decimal conversion to hexadecimalDecoct ()-Decimal conversion to octalHexdec ()-16 Conversion to decimalOctdec
AOP is required in the project using the Runkit module, but the development environment for the team members is Windows, and the Runkit module does not provide DLL extensions in the Windows environment and compiles itself only.
The following is a
One, decimal system conversion function description1, decimal to Binary decbin () function, the following example
Echo Decbin (12); Output 1100
Echo Decbin (26); Output 11010
Decbin
(PHP 3, PHP 4, PHP 5)
Decbin--decimal conversion into
AOP is required in the project using the Runkit module, but the development environment for the team members is Windows, and the Runkit module does not provide DLL extensions in the Windows environment and compiles itself only.The following is a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.