Transliteration

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
dstefani
Forum Contributor
Posts: 140
Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA

Transliteration

Post 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
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

strtr() .. it's exactly the same as tr(). However, str_replace() is a lot quicker in most cases.
Post Reply