Skip to content

Instantly share code, notes, and snippets.

@hinzundcode
Created July 9, 2011 11:26
Show Gist options
  • Save hinzundcode/1073530 to your computer and use it in GitHub Desktop.
Save hinzundcode/1073530 to your computer and use it in GitHub Desktop.
Leetspeak Generator
<?php
header('Content-type: text/plain; charset=utf8');
$input = "hab me eben nen leet-speak generator geschrieben..";
$words = array(
'one' => 1,
'to' => 2,
'too' => 2,
'drei' => 3,
'for' => 4,
'acht' => 8,
'eight' => 8,
'aite' => 8,
'ate' => 8,
'nine' => 9,
'nein' => 9
);
$chars = array(
'A' => array('4', '@', '/\\', '/-\\', '?', '^', 'α', 'λ'),
'B' => array('8', '|3', 'ß', 'l³', '|>', '13', 'I3'),
'C' => array('(', '[', '<', '©', '¢'),
'D' => array('|)', '|]', 'Ð', 'đ', '1)'),
'E' => array('3', '€', '&', '£', 'ε'),
'F' => array('|=', 'PH', '|*|-|', '|"', 'ƒ', 'l²'),
'G' => array('6', '&, 9'),
'H' => array('4', '|-|', '#', '}{', ']-[', '/-/', ')-('),
'I' => array('!', '1', '|', ']['),
'J' => array('_|', '¿'),
'K' => array('|<', '|{', '|(', 'X'),
'L' => array('1', '|_', '£', '|', '][_'),
'M' => array('/\\/\\', '/v\\', '|V|', ']V[', '|\\/|', 'AA', '[]V[]', '|11', '/|\\', '^^', '(V),|Y|'),
'N' => array('|\\|', '/\\/', '/V', '|V', '/\\/', '|1', '2', '?', '(\\), 11'),
'O' => array('0', '9', '()', '[]', '*', '°', '<>', 'ø', '{[]}'),
'P' => array('|°', 'p', '|>', '|*', '[]D', '][D', '|²', '|?', '|D'),
'Q' => array('0_', '0,'),
'R' => array('2', '|2', '1², ®', '?', 'я, 12, .-'),
'S' => array('5', '$', '§', '?', 'ŝ', 'ş'),
'T' => array('7', '+', '†', '\'][\'', '|'),
'U' => array('|_|', 'µ', '[_]', 'v'),
'V' => array('\\/', '|/', '\\|', '\\\''),
'W' => array('\\/\\/', 'VV', '\\A/', '\\\'', 'uu', '\\^/', '\\|/'),
'X' => array('><', ')(', '}{', '%', '?', '×', ']['),
'Y' => array('`/', '°/', '9', '¥'),
'Z' => array('z', '2', '"/_'),
'Ä' => array('43', '°A°', '°4°'),
'Ö' => array('03', '°O°'),
'Ü' => array('|_|3', '°U°')
);
$leet = strtoupper($input);
$leet = str_replace(array_keys($words), array_values($words), $leet);
$leet = str_split($leet);
foreach ($leet as $i => $c) {
if (isset($chars[$c]))
$leet[$i] = $chars[$c][array_rand($chars[$c])];
}
$leet = implode('', $leet);
echo $leet;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment