hex2bin() function in PHP


The hex2bin() function is used to convert a string of hexadecimal to ASCII character.

Syntax

hex2bn(str)

Parameters

  • str − The hexadecimal value to be converted

Return

The hex2bin() function returns the ASCII character of the converted string, or FALSE on failure.

Example

The following is an example −

Live Demo

<?php
   echo hex2bin("6578616d706c65206865782064617461");
?>

Output

example hex data

Updated on: 30-Jul-2019

29 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements