1--TEST--
2Test number_format() - basic function test number_format()
3--FILE--
4<?php
5echo "*** Testing number_format() : basic functionality ***\n";
6
7$values = array(1234.5678,
8                -1234.5678,
9                1234.6578e4,
10                -1234.56789e4,
11                0x1234CDEF,
12                02777777777,
13                "123456789",
14                "123.456789",
15                "12.3456789e1",
16                true,
17                false);
18
19echo "\n-- number_format tests.....default --\n";
20for ($i = 0; $i < count($values); $i++) {
21    $res = number_format($values[$i]);
22    var_dump($res);
23}
24
25echo "\n-- number_format tests.....with two dp --\n";
26for ($i = 0; $i < count($values); $i++) {
27    $res = number_format($values[$i], 2);
28    var_dump($res);
29}
30
31echo "\n-- number_format tests.....English format --\n";
32for ($i = 0; $i < count($values); $i++) {
33    $res = number_format($values[$i], 2, '.', ' ');
34    var_dump($res);
35}
36
37echo "\n-- number_format tests.....French format --\n";
38for ($i = 0; $i < count($values); $i++) {
39    $res = number_format($values[$i], 2, ',' , ' ');
40    var_dump($res);
41}
42?>
43--EXPECT--
44*** Testing number_format() : basic functionality ***
45
46-- number_format tests.....default --
47string(5) "1,235"
48string(6) "-1,235"
49string(10) "12,346,578"
50string(11) "-12,345,679"
51string(11) "305,450,479"
52string(11) "402,653,183"
53string(11) "123,456,789"
54string(3) "123"
55string(3) "123"
56string(1) "1"
57string(1) "0"
58
59-- number_format tests.....with two dp --
60string(8) "1,234.57"
61string(9) "-1,234.57"
62string(13) "12,346,578.00"
63string(14) "-12,345,678.90"
64string(14) "305,450,479.00"
65string(14) "402,653,183.00"
66string(14) "123,456,789.00"
67string(6) "123.46"
68string(6) "123.46"
69string(4) "1.00"
70string(4) "0.00"
71
72-- number_format tests.....English format --
73string(8) "1 234.57"
74string(9) "-1 234.57"
75string(13) "12 346 578.00"
76string(14) "-12 345 678.90"
77string(14) "305 450 479.00"
78string(14) "402 653 183.00"
79string(14) "123 456 789.00"
80string(6) "123.46"
81string(6) "123.46"
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) "1,00"
96string(4) "0,00"
97