Skip to content

Instantly share code, notes, and snippets.

@hmbashar
Created October 9, 2019 08:15
Show Gist options
  • Select an option

  • Save hmbashar/4722e62c5ac71c222f77205af3c4e823 to your computer and use it in GitHub Desktop.

Select an option

Save hmbashar/4722e62c5ac71c222f77205af3c4e823 to your computer and use it in GitHub Desktop.
<?php
class BanglaConverter {
public static $bn = array("১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯", "০");
public static $en = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
public static function bn2en($number) {
return str_replace(self::$bn, self::$en, $number);
}
public static function en2bn($number) {
return str_replace(self::$en, self::$bn, $number);
}
}
echo BanglaConverter::bn2en("This is ২০১৬\n");
echo BanglaConverter::en2bn("42 আমার প্রিয় সংখ্যা\n");
@nilooyiiooo
Copy link

I'm using this code on my site Converter Web Tools (bangla converter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment