How To Convert Strings in Hex Format?

deepak singh
Posts: 686
Joined: Fri Sep 30, 2016 4:19 pm

How To Convert Strings in Hex Format?

Postby deepak singh » Sat Oct 01, 2016 4:46 pm

How To Convert Strings in Hex Format?

rameshkhd
Posts: 1279
Joined: Sun Aug 28, 2016 10:45 am

Re: How To Convert Strings in Hex Format?

Postby rameshkhd » Sat Oct 01, 2016 4:57 pm

If you want convert a string into hex format, you can use the bin2hex() function. Here is a PHP script on how to use bin2hex():
<?php
$string = "Hello\tworld!\n";
print($string."\n");
print(bin2hex($string)."\n");
?>
This script will print:
Hello world!

48656c6c6f09776f726c64210a


Return to “PHP”

Who is online

Users browsing this forum: No registered users and 3 guests