Is there a PHP function that translates ligatures like "Æ" into "AE" and vice versa?
Asked
Active
Viewed 290 times
-2
-
possible duplicate of [PHP Transliteration](http://stackoverflow.com/questions/1284535/php-transliteration) – Sammitch Mar 31 '14 at 21:17
-
You can always build your own if it's not going to be too intensive. A simple `preg_replace()` or similar function can do this quite easily. – Funk Forty Niner Mar 31 '14 at 21:19
2 Answers
1
You could use one of a few of PHP's functions, one being the preg_replace()
function.
<?php
$replace='Æ';
$new=str_replace('Æ', 'AE', $replace);
echo $new;
Will echo AE
Vice-versa would be:
<?php
$replace='AE';
$new=str_replace('AE', 'Æ', $replace);
echo $new;
Will echo Æ
Using the str_replace()
function, it can be used in sentences, such as:
echo str_replace("Æ","AE","Æ has been replaced from using: ") . "Æ";
Which will echo AE has been replaced from using: Æ

Funk Forty Niner
- 74,450
- 15
- 68
- 141