Created
January 11, 2019 07:09
-
-
Save sangheonhan/fad41d7580c6f42167223b7dd2f7f044 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 | |
$digitTable = array( | |
0 => array('0', '○', 'О'), | |
1 => array('① ', '⑴ ', '1'), | |
2 => array('② ', '⑵ ', '2'), | |
3 => array('③ ', '⑶ ', '3'), | |
4 => array('④ ', '⑷ ', '4'), | |
5 => array('⑤ ', '⑸ ', '5'), | |
6 => array('⑥ ', '⑹ ', '6'), | |
7 => array('⑦ ', '⑺ ', '7'), | |
8 => array('⑧ ', '⑻ ', '8'), | |
9 => array('⑨ ', '⑼ ', '9'), | |
); | |
if (isset($argv[1]) == false) { | |
echo "Usage: {$argv[0]} <STRING>".PHP_EOL; | |
exit(1); | |
} | |
foreach (preg_split('//u', $argv[1]) as $ch) { | |
if (preg_match('/^\d$/', $ch)) { | |
echo $digitTable[intval($ch)][rand(0, count($digitTable[intval($ch)]) - 1)]; | |
} else { | |
echo $ch; | |
} | |
} | |
echo PHP_EOL; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment