Created
September 13, 2015 17:33
-
-
Save vhdm/5f87e8320153ff9a55d5 to your computer and use it in GitHub Desktop.
Convert number to persion in php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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