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