1--TEST--
2Test number_format() - basic function test number_format()
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
18echo "\n number_format tests.....default\n";
19for ($i = 0; $i < count($values); $i++) {
20    $res = number_format($values[$i]);
21    var_dump($res);
22}
23
24echo "\n number_format tests.....with two dp\n";
25for ($i = 0; $i < count($values); $i++) {
26    $res = number_format($values[$i], 2);
27    var_dump($res);
28}
29
30echo "\n number_format tests.....English format\n";
31for ($i = 0; $i < count($values); $i++) {
32    $res = number_format($values[$i], 2, '.', ' ');
33    var_dump($res);
34}
35
36echo "\n number_format tests.....French format\n";
37for ($i = 0; $i < count($values); $i++) {
38    $res = number_format($values[$i], 2, ',' , ' ');
39    var_dump($res);
40}
41?>
42--EXPECT--
43 number_format tests.....default
44string(5) "1,235"
45string(6) "-1,235"
46string(10) "12,346,578"
47string(11) "-12,345,679"
48string(11) "305,450,479"
49string(11) "402,653,183"
50string(11) "123,456,789"
51string(3) "123"
52string(3) "123"
53string(1) "0"
54string(1) "1"
55string(1) "0"
56
57 number_format tests.....with two dp
58string(8) "1,234.57"
59string(9) "-1,234.57"
60string(13) "12,346,578.00"
61string(14) "-12,345,678.90"
62string(14) "305,450,479.00"
63string(14) "402,653,183.00"
64string(14) "123,456,789.00"
65string(6) "123.46"
66string(6) "123.46"
67string(4) "0.00"
68string(4) "1.00"
69string(4) "0.00"
70
71 number_format tests.....English format
72string(8) "1 234.57"
73string(9) "-1 234.57"
74string(13) "12 346 578.00"
75string(14) "-12 345 678.90"
76string(14) "305 450 479.00"
77string(14) "402 653 183.00"
78string(14) "123 456 789.00"
79string(6) "123.46"
80string(6) "123.46"
81string(4) "0.00"
82string(4) "1.00"
83string(4) "0.00"
84
85 number_format tests.....French format
86string(8) "1 234,57"
87string(9) "-1 234,57"
88string(13) "12 346 578,00"
89string(14) "-12 345 678,90"
90string(14) "305 450 479,00"
91string(14) "402 653 183,00"
92string(14) "123 456 789,00"
93string(6) "123,46"
94string(6) "123,46"
95string(4) "0,00"
96string(4) "1,00"
97string(4) "0,00"
98