You are here: Home Programming PHP How to use PHP bin2hex() Function?

How to use PHP bin2hex() Function?

 

 

 

How to use PHP bin2hex() Function?

 

The bin2hex() function converts a string of ASCII characters to hexadecimal values. The string can be converted back using the pack() function.

 

Syntax

 bin2hex(string) 

 

Problem

<?php
 $str = "Hello world!";
 echo bin2hex($str) . "<br />";
 echo pack("H*",bin2hex($str)) . "<br />";
 ?>

Solution

48656c6c6f20776f726c6421
Hello world!


Clientele

 

SIGN UP RIGHT NOW FOR EMAIL UPDATES

Share this post


blog comments powered by Disqus

Print PDF

HTML Codes
opinions powered by SendLove.to

Our valuable member Khabza has been with us since Thursday, 08 July 2010.

Show Other Articles Of This Author

Back to top
SA Topsites :: Simphiwe - Find me on Bloggers.com

Copyright © Green IT Web - Blog by Khabza in Cape Town 2012

Template by Joomla 1.7 Templates & Szablony Joomla.