
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What is the PHP equivalent of MySQL's UNHEX()?
You can use hex2bin() function since it is the PHP equivalent of MySQL's UNHEX().
The syntax is as follows −
$anyVariableName = hex2bin("yourHexadecimalValue");
To understand the above syntax, let us implement the above syntax in PHP. The PHP code is as follows −
$myFirstValue = hex2bin("7777772E4D7953514C4578616D706C652E636F6D"); var_dump($myFirstValue); $mySecondValue=hex2bin("416476616E6365644A617661576974684672616D65776F726B"); echo('<br>'); var_dump($mySecondValue);
The snapshot of PHP code is as follows −
Here is the snapshot of The output −
Here is the MySQL UNHEX() −
Case 1 − The query is as follows −
mysql> SELECT UNHEX("7777772E4D7953514C4578616D706C652E636F6D");
The following is The output −
+---------------------------------------------------+ | UNHEX("7777772E4D7953514C4578616D706C652E636F6D") | +---------------------------------------------------+ | www.MySQLExample.com | +---------------------------------------------------+ 1 row in set (0.00 sec)
Case 2 − The query is as follows −
mysql> SELECT UNHEX("416476616E6365644A617661576974684672616D65776F726B");
Here is the output −
+-------------------------------------------------------------+ | UNHEX("416476616E6365644A617661576974684672616D65776F726B") | +-------------------------------------------------------------+ | AdvancedJavaWithFramework | +-------------------------------------------------------------+ 1 row in set (0.00 sec)
- Related Articles
- What is the use of MySQL UNHEX() function?
- What is the PHP stripos() equivalent in MySQL?
- What is the Java equivalent to MySQL's smallint?
- Is there PHP basename() equivalent in MySQL?
- What is the equivalent of MySQL TIME_TO_SEC() method in PHP to convert datetime to seconds?
- What is the equivalent of EXCEPT in MySQL?
- What is the MySQL SELECT INTO Equivalent?
- What's the Kotlin equivalent of Java's String[]?
- What is the C# equivalent to Java's isInstance()?
- What is the equivalent of Java long in the context of MySQL variables?
- What is the equivalent of Matlab's surf(x,y,z,c) in Matplotlib?
- PHP equivalent of friend or internal
- What is the C++ equivalent of sprintf?
- What is Python equivalent of the ! operator?
- Is their a JavaScript Equivalent to PHP explode()?

Advertisements