Created
          October 10, 2013 15:34 
        
      - 
      
- 
        Save gregmercer/6920405 to your computer and use it in GitHub Desktop. 
    php string to hex function
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function strtohex($string) | |
| { | |
| $string = str_split($string); | |
| foreach($string as &$char) | |
| $char = "\x".dechex(ord($char)); | |
| return implode('',$string); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Why not just
bin2hex?