Converting string to hex


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.