1--TEST-- 2numfmt_format_currency() icu >= 4.8 3--SKIPIF-- 4<?php if( !extension_loaded( 'intl' ) ) print 'skip intl extension not loaded'; ?> 5--FILE-- 6<?php 7 8/* 9 * Format a number using misc currencies/locales. 10 */ 11/* 12 * TODO: doesn't pass on ICU 3.6 because 'ru' and 'uk' locales changed 13 * currency formatting. 14 */ 15 16 17function ut_main() 18{ 19 $locales = array( 20 'en_UK' => 'GBP', 21 'en_US' => 'USD', 22 'ru' => 'RUR', 23 'uk' => 'UAH', 24 'en' => 'UAH' 25 ); 26 27 $res_str = ''; 28 $number = 1234567.89; 29 30 foreach( $locales as $locale => $currency ) 31 { 32 $fmt = ut_nfmt_create( $locale, NumberFormatter::CURRENCY ); 33 $res_str .= "$locale: " . var_export( ut_nfmt_format_currency( $fmt, $number, $currency ), true ) . "\n"; 34 } 35 return $res_str; 36} 37 38include_once( 'ut_common.inc' ); 39 40// Run the test 41ut_run(); 42 43?> 44--EXPECTF-- 45en_UK: '£1,234,567.89' 46en_US: '$1,234,567.89' 47ru: '1 234 567,89 р.' 48uk: '1 234 567,89 ₴' 49en: 'UAH%A1,234,567.89' 50