Skip to content

Instantly share code, notes, and snippets.

@aminrasouli
Last active February 2, 2018 13:50
Show Gist options
  • Save aminrasouli/511d74709539cb6f16dc30cc47c89d74 to your computer and use it in GitHub Desktop.
Save aminrasouli/511d74709539cb6f16dc30cc47c89d74 to your computer and use it in GitHub Desktop.
toEngNumber
function to_en( $string ) {
$persian = array( '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹' );
$arabic = array( '٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩' );
$english = range( 0, 9 );
$converted = str_replace( $persian, $english, $string );
$converted = str_replace( $arabic, $english, $converted );
return $converted;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment