Zend_Locale_Format::toNumberSystem()
Zend_Locale_Format::toNumberSystem( ) is our new baby static method. I was talking about this method here for weeks but without knowing it’s future name. it’s ready now. it’s a simple function converts between many notations of numbers. see the examples :
$string = “١٠٠”; //the number 100 in Arabic notation
//this converts ١٠٠ to 100
$new = Zend_Locale_Format::toNumberSystem($string, ‘Arab’, null);
print ‘new : ‘ . $new . ‘<br>’;
//this converts 100 to ١٠٠
$old = Zend_Locale_Format::toNumberSystem($new, null, ‘Arab’);
print ‘old : ‘ . $old . ‘<br>’;
//this converts from Arabic notation to Bengali notation of numbers
$mystring = Zend_Locale_Format::toNumberSystem($string, ‘Arab’, ‘Beng’);
print ‘Arab to Beng : ‘ . $mystring . ‘<br>’ ;
the supported notations are :
- Arab [Arabic]
- Deva [Devanagari]
- Beng [Bengali]
- Guru [Gurmukhi]
- Gujr [Gujarati]
- Orya [Oriya]
- Taml [Tamil]
- Telu [Telugu]
- Knda [Kannada]
- Mlym [Malayalam]
- Tale [Thai]
- Laoo [Lao]
- Tibt [Tibetan]
- Mymr [Myanmar]
- Khmr [Khmer]
- Mong [Mongolian]
- Limb [Limbu]
- Talu [New_Tai_Lue]
- Bali [Balinese]
- Nkoo [Nko]
tell me if you see your language in this list as I don’t know any thing about most of this languages
lol. anyway, what I’m sure about now is the Arabic part which was extensively tested.
you can get the code from SVN now from http://framework.zend.com . also, be ready for the 0.6.0 preview release on the middle of this month.
No related posts.
Hey, I'm