Last active
September 17, 2016 18:53
-
-
Save elzup/b2f9f50c5b6a266c0425b38db7fabb72 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
# 111000 | |
# 111000 | |
# 001010 | |
# 110011 | |
# | |
# 111000 | |
# 111000 | |
# 001110 | |
# 101101 | |
# | |
# 111000 | |
# 111000 | |
# 001110 | |
# 010111 | |
# | |
# 111000 | |
# 111000 | |
# 001110 | |
# 101001 | |
# | |
# %e3%82%b3%e3%83%ad%e3%83%97%e3%83%a9 | |
# e3 82 b3 e3 83 ad e3 83 97 e3 83 a9 | |
# | |
# | |
$CO = <<<CO | |
111000 | |
111000 | |
001010 | |
110011 | |
CO; | |
$LO = <<<LO | |
111000 | |
111000 | |
001110 | |
101101 | |
LO; | |
$P = <<<P | |
111000 | |
111000 | |
001110 | |
010111 | |
P; | |
$L = <<<L | |
111000 | |
111000 | |
001110 | |
101001 | |
L; | |
echo implode('', array_map(function($v) { return magic($v); }, array($CO, $LO, $P, $L))); | |
function magic($text) { | |
return packHex(base_bin2hex(trim_all($text))); | |
} | |
function trim_all($str) { | |
return str_replace(PHP_EOL, '', $str); | |
} | |
function base_bin2hex($str) { | |
return base_convert($str, 2, 16); | |
} | |
function packHex($v) { | |
return pack('H*', $v); | |
} | |
# => 111000111000001010110011111000111000001110101101111000111000001110010111111000111000001110101001 | |
echo PHP_EOL; | |
# echo urlencode('コロプラ') . PHP_EOL; | |
# echo urldecode('%e3%82%b3%e3%83%ad%e3%83%97%e3%83%a9') . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment