Annotation of embedaddon/php/ext/standard/tests/strings/money_format_basic1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test money_format() function : basic functionality using national currency symbols
                      3: --SKIPIF--
                      4: <?php
                      5:        if (!function_exists('money_format')) {
                      6:                die("SKIP money_format - not supported\n");
                      7:        }
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: /* Prototype  : string money_format  ( string $format  , float $number  )
                     12:  * Description: Formats a number as a currency string
                     13:  * Source code: ext/standard/string.c
                     14: */
                     15: 
                     16: // ===========================================================================================
                     17: // = We do not test for exact return-values, as those might be different between OS-versions =
                     18: // ===========================================================================================
                     19: 
                     20: echo "*** Testing money_format() : basic functionality***\n";
                     21: 
                     22: $value = 1234.5678;
                     23: $negative_value = -1234.5678;
                     24: 
                     25: // Format with 14 positions of width, 8 digits of
                     26: // left precision, 2 of right precision using national 
                     27: // format for en_US
                     28: echo "Format values with 14 positions, 8 digits to left, 2 to right using national format\n";
                     29: echo gettype(money_format('%14#8.2n', $value))."\n";
                     30: echo gettype(money_format('%14#8.2n', $negative_value))."\n";
                     31: 
                     32: // Same again but use '(' for negative values 
                     33: echo "Format again but with ( for negative values\n";
                     34: echo gettype(money_format('%(14#8.2n', $value))."\n";
                     35: echo gettype(money_format('%(14#8.2n', $negative_value))."\n";
                     36: 
                     37: // Same again but use a '0' for padding character
                     38: echo "Format with 0 for padding character\n";
                     39: echo gettype(money_format('%=014#8.2n', $value))."\n";
                     40: echo gettype(money_format('%=014#8.2n', $negative_value))."\n";
                     41: 
                     42: // Same again but use a '*' for padding character
                     43: echo "Format again with * for padding character\n";
                     44: echo gettype(money_format('%=*14#8.2n', $value))."\n";
                     45: echo gettype(money_format('%=*14#8.2n', $negative_value))."\n";
                     46: 
                     47: // Same again but disable grouping character
                     48: echo "Format again but disable grouping character\n"; 
                     49: echo gettype(money_format('%=*^14#8.2n', $value))."\n";
                     50: echo gettype(money_format('%=*^14#8.2n', $negative_value))."\n";
                     51: 
                     52: // Same again but suppress currency symbol
                     53: echo "Format again suppress currency symbol\n"; 
                     54: echo gettype(money_format('%=*!14#8.2n', $value))."\n";
                     55: echo gettype(money_format('%=*!14#8.2n', $negative_value))."\n";
                     56: 
                     57: ?>
                     58: ===DONE===
                     59: --EXPECT--
                     60: *** Testing money_format() : basic functionality***
                     61: Format values with 14 positions, 8 digits to left, 2 to right using national format
                     62: string
                     63: string
                     64: Format again but with ( for negative values
                     65: string
                     66: string
                     67: Format with 0 for padding character
                     68: string
                     69: string
                     70: Format again with * for padding character
                     71: string
                     72: string
                     73: Format again but disable grouping character
                     74: string
                     75: string
                     76: Format again suppress currency symbol
                     77: string
                     78: string
                     79: ===DONE===
                     80: 

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