Wallogit.com
2017 © Pedro Peláez
persian text convertion
Replace Arabic numbers with Persian numbers, (*1)
<?php
$res = PersianChar::ar_numbers('۱۲۳۴1234١٢٣٤')
// ۱۲۳۴1234۱۲۳۴
Replace English numbers with Persian numbers, (*2)
<?php
$res = PersianChar::en_numbers('۱۲۳۴1234١٢٣٤')
// ۱۲۳۴۱۲۳۴١٢٣٤
Replace both Arabic and English numbers with Persian numbers, (*3)
<?php
$res = PersianChar::numbers('۱۲۳۴1234١٢٣٤')
// ۱۲۳۴۱۲۳۴۱۲۳۴
Replace none Persian character with Persian character. This method covers most character in Arabic character table., (*4)
<?php
$res = PersianChar::letters('ؠک مټن تﺴت')
// یک متن تست
Note that this method will also remove non printable characters like U+200F, (*5)
php composer.phar require intuxicated/persian-text '~1.0@dev'
git clone https://github.com/intuxicated/PersianChar.git
Remove namespace Intuxicated\PersianChar; if your code doesn't support php namespace, (*6)