Annotation of embedaddon/php/ext/standard/tests/math/number_format_basic.phpt, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>