Posted By

etangle on 01/23/10


Tagged

hex hexa


Versions (?)

Converting string to hex


 / Published in: PHP
 

URL: http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/

  1. function strToHex($string)
  2. {
  3. $hex='';
  4. for ($i=0; $i < strlen($string); $i++)
  5. {
  6. $hex .= dechex(ord($string[$i]));
  7. }
  8. return $hex;
  9. }

Report this snippet  

You need to login to post a comment.