Created
July 23, 2017 00:03
-
-
Save BrianValente/290ab5b3d61b88b2d8e56800bcdc1752 to your computer and use it in GitHub Desktop.
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
<?php | |
namespace UpsideDownText; | |
class UpsideDownText { | |
public static function convert_to_upsidedown_unicode($match) | |
{ | |
$flipTable = array( | |
'!' => '¡', | |
'¡' => '!', | |
'"' => ',,', | |
'&' => '⅋', | |
"'" => ',', | |
'(' => ')', | |
')' => '(', | |
',' => "'", | |
'.' => '˙', | |
'0' => '0', | |
'1' => 'Ɩ', | |
'2' => 'ᄅ', | |
'3' => 'Ɛ', | |
'4' => 'ᔭ', | |
'5' => 'ϛ', | |
'6' => '9', | |
'7' => 'ㄥ', | |
'8' => '8', | |
'9' => '6', | |
'<' => '>', | |
'>' => '<', | |
'?' => '¿', | |
'A' => 'ɐ', | |
'B' => 'q', | |
'C' => 'ɔ', | |
'D' => 'p', | |
'E' => 'ǝ', | |
'F' => 'ɟ', | |
'G' => 'ƃ', | |
'H' => 'ɥ', | |
'I' => 'ᴉ', | |
'J' => 'ɾ', | |
'K' => 'ʞ', | |
'L' => 'l', | |
'M' => 'ɯ', | |
'N' => 'u', | |
'Ñ' => 'ñ', | |
'O' => 'o', | |
'P' => 'd', | |
'Q' => 'b', | |
'R' => 'ɹ', | |
'S' => 's', | |
'T' => 'ʇ', | |
'U' => 'n', | |
'V' => 'ʌ', | |
'W' => 'ʍ', | |
'X' => 'x', | |
'Y' => 'ʎ', | |
'Z' => 'z', | |
'[' => ']', | |
']' => '[', | |
'_' => '‾', | |
'a' => 'ɐ', | |
'b' => 'q', | |
'c' => 'ɔ', | |
'd' => 'p', | |
'e' => 'ǝ', | |
'f' => 'ɟ', | |
'g' => 'ƃ', | |
'h' => 'ɥ', | |
'i' => 'ᴉ', | |
'j' => 'ɾ', | |
'k' => 'ʞ', | |
'l' => 'l', | |
'm' => 'ɯ', | |
'n' => 'u', | |
'ñ' => 'ñ', | |
'o' => 'o', | |
'p' => 'd', | |
'q' => 'b', | |
'r' => 'ɹ', | |
's' => 's', | |
't' => 'ʇ', | |
'u' => 'n', | |
'v' => 'ʌ', | |
'w' => 'ʍ', | |
'x' => 'x', | |
'y' => 'ʎ', | |
'z' => 'z', | |
'{' => '}', | |
'}' => '{' | |
); | |
$origStr = strrev($match); | |
$newStr = ' '; | |
for ($i = 0; $i < strlen($origStr); $i++) { | |
$ch = $origStr[$i]; | |
if (array_key_exists($ch, $flipTable)) | |
$newStr .= $flipTable[$ch]; | |
else | |
$newStr .= $ch; | |
} | |
return $newStr; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment