Created
September 27, 2012 14:11
-
-
Save CodeNegar/3794225 to your computer and use it in GitHub Desktop.
php: fa to en and en to fa number
This file contains hidden or 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
<?php | |
function fadigits($text) | |
{ | |
$fa = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'); | |
$en = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); | |
return str_replace($en, $fa, $text); | |
} | |
function endigits($text) | |
{ | |
$fa = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'); | |
$en = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); | |
return str_replace($fa, $en $text); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment