Mustafa
Mustafa

Reputation: 33

Php removing unicode arabic characters

I have a text such " مُشْكِلَةٌ " in db. How can I get " مشكلة " from this text in php( str_replace etc ). I have tried str_replace it didn't work

Upvotes: 1

Views: 1145

Answers (1)

zakhefron
zakhefron

Reputation: 1443

Code

$string = 'مُشْكِلَةٌ';
$diacritic = array('ِ', 'ُ', 'ٓ', 'ٰ', 'ْ', 'ٌ', 'ٍ', 'ً', 'ّ', 'َ');
$newString = str_replace($diacritic, '', $string);

echo "Old String : ".$string;
echo "New String : ".$newString;

Output

Old String : مُشْكِلَةٌ
New String : مشكلة

Demo

Upvotes: 2

Related Questions