Created
September 25, 2014 00:34
-
-
Save donatj/51715eb42cfd9522d5d6 to your computer and use it in GitHub Desktop.
Convert String to Escaped Hexadecimal Notation
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
#! /usr/bin/env php | |
<?php | |
$data = $argv[1]; | |
$split = str_split($data); | |
foreach($split as $ord) { | |
echo "\\x" . dechex(ord($ord)); | |
} | |
fwrite(STDERR, "\n{$data}\n"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment