1--TEST--
2Test 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
20echo "*** 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
28echo "Format values with 14 positions, 8 digits to left, 2 to right using national format\n";
29echo gettype(money_format('%14#8.2n', $value))."\n";
30echo gettype(money_format('%14#8.2n', $negative_value))."\n";
31
32// Same again but use '(' for negative values
33echo "Format again but with ( for negative values\n";
34echo gettype(money_format('%(14#8.2n', $value))."\n";
35echo gettype(money_format('%(14#8.2n', $negative_value))."\n";
36
37// Same again but use a '0' for padding character
38echo "Format with 0 for padding character\n";
39echo gettype(money_format('%=014#8.2n', $value))."\n";
40echo gettype(money_format('%=014#8.2n', $negative_value))."\n";
41
42// Same again but use a '*' for padding character
43echo "Format again with * for padding character\n";
44echo gettype(money_format('%=*14#8.2n', $value))."\n";
45echo gettype(money_format('%=*14#8.2n', $negative_value))."\n";
46
47// Same again but disable grouping character
48echo "Format again but disable grouping character\n";
49echo gettype(money_format('%=*^14#8.2n', $value))."\n";
50echo gettype(money_format('%=*^14#8.2n', $negative_value))."\n";
51
52// Same again but suppress currency symbol
53echo "Format again suppress currency symbol\n";
54echo gettype(money_format('%=*!14#8.2n', $value))."\n";
55echo gettype(money_format('%=*!14#8.2n', $negative_value))."\n";
56
57?>
58===DONE===
59--EXPECT--
60*** Testing money_format() : basic functionality***
61Format values with 14 positions, 8 digits to left, 2 to right using national format
62string
63string
64Format again but with ( for negative values
65string
66string
67Format with 0 for padding character
68string
69string
70Format again with * for padding character
71string
72string
73Format again but disable grouping character
74string
75string
76Format again suppress currency symbol
77string
78string
79===DONE===
80
81