Skip to content

Instantly share code, notes, and snippets.

@theodorosploumis
Forked from pespantelis/greeklish.php
Last active August 29, 2015 14:22
Show Gist options
  • Save theodorosploumis/b6499940e676ea65f9e1 to your computer and use it in GitHub Desktop.
Save theodorosploumis/b6499940e676ea65f9e1 to your computer and use it in GitHub Desktop.
function greeklish($string)
{
$replace_pairs = [
'Α' => 'A',
'Ά' => 'A',
'Β' => 'V',
'Γ' => 'G',
'Δ' => 'D',
'Ε' => 'E',
'Έ' => 'E',
'Ζ' => 'Z',
'Η' => 'I',
'Ή' => 'I',
'Θ' => 'Th',
'Ι' => 'I',
'Ί' => 'I',
'Ϊ' => 'I',
'΅Ι' => 'I',
'Κ' => 'K',
'Λ' => 'L',
'Μ' => 'M',
'Ν' => 'N',
'Ξ' => 'Ks',
'Ο' => 'O',
'Ό' => 'O',
'Π' => 'P',
'Ρ' => 'R',
'Σ' => 'S',
'Τ' => 'T',
'Υ' => 'Y',
'Ύ' => 'Y',
'Ϋ' => 'Y',
'΅Υ' => 'Y',
'Φ' => 'F',
'Χ' => 'X',
'Ψ' => 'Ps',
'Ω' => 'O',
'Ώ' => 'O',
'α' => 'a',
'ά' => 'a',
'β' => 'v',
'γ' => 'g',
'δ' => 'd',
'ε' => 'e',
'έ' => 'e',
'ζ' => 'z',
'η' => 'i',
'ή' => 'i',
'θ' => 'th',
'ι' => 'i',
'ί' => 'i',
'ϊ' => 'i',
'ΐ' => 'i',
'κ' => 'k',
'λ' => 'l',
'μ' => 'm',
'ν' => 'n',
'ξ' => 'ks',
'ο' => 'o',
'ό' => 'o',
'π' => 'p',
'ρ' => 'r',
'σ' => 's',
'ς' => 's',
'τ' => 't',
'υ' => 'u',
'ύ' => 'u',
'ϋ' => 'u',
'ΰ' => 'u',
'φ' => 'f',
'χ' => 'x',
'ψ' => 'ps',
'ω' => 'w',
'ώ' => 'w'
];
return strtr($string, $replace_pairs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment