Page 1 of 1

Transliteration

Posted: Tue May 10, 2005 5:00 pm
by dstefani
Has anyone seen a Transliteration function for PHP, like the one in Perl?

Code: Select all

LVALUE =~ tr/SEARCHLIST/REPLACEMENTLIST/cds
# Example # $message =~ tr/A-Za-z/N-ZA-Mn-za-m/;    # rot13 encryption
Thanks,

- dstefani

Posted: Wed May 11, 2005 3:42 am
by onion2k
strtr() .. it's exactly the same as tr(). However, str_replace() is a lot quicker in most cases.