I have an Arabic text and you want to replace the "Initial" and "Medial" forms of some letters (not all forms) with other letters or symbols;
Example:
$text = '...وقد تم تصميم وبناء جميع مكونات الطائرة';
I need to replace the Initial form of the letter "ت", which is in the word "تم" with another letter; the available "ت" in "مكونات", which is the final form of this letter, is not replaced.
It seems that character codes (Unicode) cannot be used str_replace()to find a specific form of writing and replace it.
Note:
Most Arabic letters have different meanings:
- Initial form: used at the beginning of a word, for example "ت" in "تم".
- Medial form: used in the middle of a word, for example, "ت" in "نستعين".
- Final form: used in the last word, for example "ت" in "مكونات".
see wikipedia.org for more information.
source
share