Skip to content

Instantly share code, notes, and snippets.

@donatj
Created September 25, 2014 00:34
Show Gist options
  • Save donatj/51715eb42cfd9522d5d6 to your computer and use it in GitHub Desktop.
Save donatj/51715eb42cfd9522d5d6 to your computer and use it in GitHub Desktop.
Convert String to Escaped Hexadecimal Notation
#! /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