Skip to content

Instantly share code, notes, and snippets.

@MightyPork
Created October 18, 2015 13:04
Show Gist options
  • Save MightyPork/2ed80c7c67f405d2d03a to your computer and use it in GitHub Desktop.
Save MightyPork/2ed80c7c67f405d2d03a to your computer and use it in GitHub Desktop.
<?php
dehexify("414D415A494E47");
hexify("Banana.");
function dehexify($x) {
echo implode('', array_map('chr', array_map('hexdec', explode(',', chunk_split($x, 2, ','))))) . "\n";
}
function hexify($x) {
echo strtoupper(implode('', array_map('dechex', array_map('ord', str_split($x))))) . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment