php base conversion function is as follows:
bindec() — Convert binary to decimal
decbin() — Convert decimal to binary
dechex() — Convert decimal to hexadecimal
decoct() — Convert decimal to octal
hexdec () — Convert hexadecimal to decimal
octdec() — Convert octal to decimal
base_convert() – Convert numbers between arbitrary base systems
The application is explained as follows:
One, decimal system conversion Function explanation
1, 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 -- Convert decimal to binary
Explanation
string decbin (int number)
Returns a string containing the binary representation of the given number parameter. The maximum value that can be converted is 4294967295 in decimal, and the result is a string of 32 ones.
2, decimal to octal decoct() function
echo decoct(15); //Output 17
echo decoct(264); //Output 410
decoct
(PHP 3, PHP 4, PHP 5)
decoct - - Decimal to octal conversion
Explanation
string decoct (int number)
Returns a string containing the octal representation of the given number parameter. The maximum value that can be converted is 4294967295 in decimal, and the result is "37777777777".
3, decimal to hexadecimal dechex() function
echo dechex(10); //Output a
echo dechex(47); //Output 2f
dechex
(PHP 3, PHP 4, PHP 5)
dechex -- Convert decimal to hexadecimal
Explanation
string dechex (int number)
Returns a string containing the hexadecimal representation of the given number parameter. The maximum value that can be converted is 4294967295 in decimal, and the result is "ffffffff".
2. Explanation of binary system conversion function
1. Bin2hex() function from binary to hexadecimal
$binary = "11111001";
$hex = dechex(bindec($binary));
echo $ hex;//Output f9
bin2hex
(PHP 3 = 3.0.9, PHP 4, PHP 5)
bin2hex -- Convert binary data to hexadecimal representation
Explanation
string bin2hex (string str)
Return ASCII characters String is the hexadecimal representation of parameter str. Conversion applies byte method, high nibble first.
2, Bindec() function to convert binary to decimal
echo bindec(\'110011\'); //Output 51
echo bindec(\'000110011\'); //Output 51
echo bindec(\' 111\'); //Output 7
bindec
(PHP 3, PHP 4, PHP 5)
bindec -- binary to decimal conversion
clarification
number bindec (string binary_string)
returns the decimal of the binary number represented by the binary_string parameter equal value.
bindec() Converts a binary number to an integer. The largest number that can be converted is 31 digits, or 2147483647 in decimal. Starting with PHP 4.1.0, this function can handle large values, in which case it returns a float type.
Three, octal system (octal system) conversion function explanation
Octal to decimal octdec() function
echo octdec(\'77\'); //Output 63
echo octdec(decoct(45)); //Output 45
octdec
(PHP 3, PHP 4, PHP 5)
octdec -- Convert octal to decimal
Explain
number octdec (string octal_string)
Returns the decimal equivalent of the octal number represented by the octal_string parameter. The largest value that can be converted is 17777777777 or 2147483647 in decimal. Starting with PHP 4.1.0, this function can handle large numbers, in which case it returns a float type.
IV. Explanation of hexadecimal (hexadecimal) conversion function
Hexadecimal to decimal hexdec() function
var_dump(hexdec("See"));
var_dump(hexdec("ee"));
/ / both print "int(238)"
var_dump(hexdec("that")); // print "int(10)"
var_dump(hexdec("a0")); // print "int(160)"
hexdec
(PHP 3, PHP 4, PHP 5)
hexdec -- Convert hexadecimal to decimal
Explain
number hexdec (string hex_string)
Return the hexadecimal number equivalent to the hex_string parameter Decimal. hexdec() Converts a hexadecimal string to a decimal number. The maximum value that can be converted is 7ffffffff, which is 2147483647 in decimal. Starting with PHP 4.1.0, this function can handle large numbers, in which case it returns a float type.
hexdec() Converts all non-hexadecimal characters encountered to 0. This way, all zeros on the left are ignored, but zeros on the right are included in the value.
Five, arbitrary base_convert() function
$hexadecimal = \'A37334\';
echo base_convert($hexadecimal, 16, 2);//Output 101000110111001100110100
base_convert
(PHP 3 = 3.0.6, PHP 4, PHP 5)
base_convert -- at any enter Convert numbers between bases
Explanation
string base_convert (string number, int frombase, int tobase)
Returns a string containing the representation of number in tobase base. The base of number itself is specified by frombase. Both frombase and tobase can only be between 2 and 36 (inclusive). Numbers above decimal are represented by the letters a-z, such as a for 10, b for 11, and z for 35.

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment
