Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PHP: Converting Numbers functions Persian To English & English To Persian
function convertNumbersFaToEn($number)
{
$persian = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
$num = range(0, 9);
return str_replace($persian, $num, $number);
}
function convertNumbersEnToFA($number)
{
$persian = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
$num = range(0, 9);
return str_replace( $num,$persian ,$number);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.