Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
convert Arabic character to Persian (Farsi) - PHP
<?php
public static function arabicToPersian($string)
{
$characters = [
'ك' => 'ک',
'دِ' => 'د',
'بِ' => 'ب',
'زِ' => 'ز',
'ذِ' => 'ذ',
'شِ' => 'ش',
'سِ' => 'س',
'ى' => 'ی',
'ي' => 'ی',
'١' => '۱',
'٢' => '۲',
'٣' => '۳',
'٤' => '۴',
'٥' => '۵',
'٦' => '۶',
'٧' => '۷',
'٨' => '۸',
'٩' => '۹',
'٠' => '۰',
];
return str_replace(array_keys($characters), array_values($characters),$string);
}
?>
@iBelit
Copy link

iBelit commented Oct 21, 2018

سپاس دوست گرامی

@tarnamaco
Copy link

tarnamaco commented Nov 27, 2018

عالی و بسیار کاربردی

@alirezapars
Copy link

alirezapars commented Jan 22, 2019

AAA Li

@RezaAghaeiii
Copy link

RezaAghaeiii commented Jun 5, 2019

قصد داشتم برای تبدیل عربی به فارسی از پکیج استفاده کنم ولی وقتی با یه فاکشن اوکی میشه فوق العاده است

@akoSalman
Copy link

akoSalman commented Aug 29, 2019

Awesome, TNX

@sadrix
Copy link

sadrix commented Jul 31, 2020

دستت درد نکنه :)

@hsa599
Copy link

hsa599 commented Jan 30, 2021

زحمت کشیدین
کاراکتر ة رو هم اضافه کنید.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment