Skip to content

Instantly share code, notes, and snippets.

@rajibdpi
Forked from nasirkhan/bengali2english.php
Created July 22, 2023 15:27
Show Gist options
  • Save rajibdpi/eaca8e2b9803a236a0c1e014af6e9991 to your computer and use it in GitHub Desktop.
Save rajibdpi/eaca8e2b9803a236a0c1e014af6e9991 to your computer and use it in GitHub Desktop.
Convert a Bengali (Bangla) Number to English Number
/**
*
* Input any number in Bengali and the following function will return the English number.
*
*/
function bn2enNumber ($number){
$search_array= array("১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯", "০");
$replace_array= array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
$en_number = str_replace($search_array, $replace_array, $number);
return $en_number;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment