Annotation of embedaddon/php/ext/intl/tests/formatter_parse_currency.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: numfmt_parse_currency()
3: --SKIPIF--
4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5: --FILE--
6: <?php
7:
8: /*
9: * Currency parsing.
10: */
11:
12: function ut_main()
13: {
14: $res_str = '';
15:
16: $fmt = ut_nfmt_create( "en_US", NumberFormatter::CURRENCY );
17: $pos = 0;
18: $currency = '';
19: $num = ut_nfmt_parse_currency( $fmt, '$9,988,776.65', $currency, $pos );
20: $res_str .= "$num $currency\n";
21:
22: $fmt = ut_nfmt_create( "en_US", NumberFormatter::CURRENCY );
23: $pos = 1;
24: $currency = '';
25: $num = ut_nfmt_parse_currency( $fmt, ' $123.45', $currency, $pos );
26: $res_str .= "$num $currency\n";
27:
28: return $res_str;
29: }
30:
31: include_once( 'ut_common.inc' );
32: ut_run();
33:
34: ?>
35: --EXPECT--
36: 9988776.65 USD
37: 123.45 USD
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>