Does anyone know where I can find a good starting point to code a function that would take a string and convert it to leet speak?
function stringToLeetSpeak($string) {
// Logic
return $leetString;
}
You can use strtr to translate certain characters:
$output = strtr($str, 'let', '137');
Or use str_replace with arrays:
$output = str_replace(array('l','e','t'), array('1','3','7'), $str);
With this you can also replace strings and not just single characters:
$output = str_replace(array('hacker'), array('hax0r'), $str);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With