Rate this script:  I Love it  /   I Hate it

string2hex


Code


<?php
  function string2hex($string)
  {
    $hex = NULL;
    for ($i=0; $i < strlen($string); $i++)
    {
      $ord = ord(substr($string,$i,1));
      if($ord < 16) {
    $hex.= '0'.dechex($ord);
      } else {
    $hex.= dechex($ord);
      }
      if ($i && ($i % 32) == 31) {
    $hex.= "\n";
      }
    }
    return $hex;
  }
?>
 

 

 
string2hex scripts | string2hex snippet | string2hex example | string2hex tutorial | string2hex code