Annotation of embedaddon/php/ext/standard/tests/math/number_format_multichar.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test number_format() - multiple character separator support
3: --FILE--
4: <?php
5: $values = array(1234.5678,
6: -1234.5678,
7: 1234.6578e4,
8: -1234.56789e4,
9: 0x1234CDEF,
10: 02777777777,
11: "123456789",
12: "123.456789",
13: "12.3456789e1",
14: null,
15: true,
16: false);
17:
18: echo " number_format tests.....multiple character decimal point\n";
19: for ($i = 0; $i < count($values); $i++) {
20: $res = number_format($values[$i], 2, '·', ' ');
21: var_dump($res);
22: }
23:
24: echo "\n number_format tests.....multiple character thousand separator\n";
25: for ($i = 0; $i < count($values); $i++) {
26: $res = number_format($values[$i], 2, '.' , ' ');
27: var_dump($res);
28: }
29:
30: echo "\n number_format tests.....multiple character decimal and thousep\n";
31: for ($i = 0; $i < count($values); $i++) {
32: $res = number_format($values[$i], 2, '·' , ' ');
33: var_dump($res);
34: }
35: ?>
36: --EXPECTF--
37: number_format tests.....multiple character decimal point
38: string(13) "1 234·57"
39: string(14) "-1 234·57"
40: string(18) "12 346 578·00"
41: string(19) "-12 345 678·90"
42: string(19) "305 450 479·00"
43: string(19) "402 653 183·00"
44: string(19) "123 456 789·00"
45: string(11) "123·46"
46: string(11) "123·46"
47: string(9) "0·00"
48: string(9) "1·00"
49: string(9) "0·00"
50:
51: number_format tests.....multiple character thousand separator
52: string(15) "1 234.57"
53: string(16) "-1 234.57"
54: string(27) "12 346 578.00"
55: string(28) "-12 345 678.90"
56: string(28) "305 450 479.00"
57: string(28) "402 653 183.00"
58: string(28) "123 456 789.00"
59: string(6) "123.46"
60: string(6) "123.46"
61: string(4) "0.00"
62: string(4) "1.00"
63: string(4) "0.00"
64:
65: number_format tests.....multiple character decimal and thousep
66: string(20) "1 234·57"
67: string(21) "-1 234·57"
68: string(32) "12 346 578·00"
69: string(33) "-12 345 678·90"
70: string(33) "305 450 479·00"
71: string(33) "402 653 183·00"
72: string(33) "123 456 789·00"
73: string(11) "123·46"
74: string(11) "123·46"
75: string(9) "0·00"
76: string(9) "1·00"
77: string(9) "0·00"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>