Skip to content

Instantly share code, notes, and snippets.

@vhdm
Created September 13, 2015 17:33
Show Gist options
  • Save vhdm/5f87e8320153ff9a55d5 to your computer and use it in GitHub Desktop.
Save vhdm/5f87e8320153ff9a55d5 to your computer and use it in GitHub Desktop.
Convert number to persion in php
function persian_digit($text){
$text = str_replace('0' , '٠' , $text);
$text = str_replace('1' , '١' , $text);
$text = str_replace('2' , '٢' , $text);
$text = str_replace('3' , '٣' , $text);
$text = str_replace('4' , '۴' , $text);
$text = str_replace('5' , '۵' , $text);
$text = str_replace('6' , '۶' , $text);
$text = str_replace('7' , '٧' , $text);
$text = str_replace('8' , '٨' , $text);
$text = str_replace('9' , '٩' , $text);
return $text;
}
echo persian_digit($string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment