Annotation of embedaddon/php/ext/standard/tests/strings/sprintf_variation53.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test sprintf() function : usage variations - with whitespaces in format strings
3: --FILE--
4: <?php
5: /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
6: * Description: Return a formatted string
7: * Source code: ext/standard/formatted_print.c
8: */
9:
10: echo "*** Testing sprintf() : with white spaces in format strings ***\n";
11:
12: // initializing the format array
13: $formats = array(
14: "% d", "% d", "% d",
15: "% f", "% f", "% f",
16: "% F", "% F", "% F",
17: "% b", "% b", "% b",
18: "% c", "% c", "% c",
19: "% e", "% e", "% e",
20: "% u", "% u", "% u",
21: "% o", "% o", "% o",
22: "% x", "% x", "% x",
23: "% X", "% X", "% X",
24: "% E", "% E", "% E"
25: );
26:
27: // initializing the args array
28:
29: foreach($formats as $format) {
30: var_dump( sprintf($format, 1234) );
31: }
32:
33: echo "Done";
34: ?>
35: --EXPECTF--
36: *** Testing sprintf() : with white spaces in format strings ***
37: string(4) "1234"
38: string(4) "1234"
39: string(4) "1234"
40: string(11) "1234.000000"
41: string(11) "1234.000000"
42: string(11) "1234.000000"
43: string(11) "1234.000000"
44: string(11) "1234.000000"
45: string(11) "1234.000000"
46: string(11) "10011010010"
47: string(11) "10011010010"
48: string(11) "10011010010"
49: string(1) "Ò"
50: string(1) "Ò"
51: string(1) "Ò"
52: string(11) "1.234000e+3"
53: string(11) "1.234000e+3"
54: string(11) "1.234000e+3"
55: string(4) "1234"
56: string(4) "1234"
57: string(4) "1234"
58: string(4) "2322"
59: string(4) "2322"
60: string(4) "2322"
61: string(3) "4d2"
62: string(3) "4d2"
63: string(3) "4d2"
64: string(3) "4D2"
65: string(3) "4D2"
66: string(3) "4D2"
67: string(11) "1.234000E+3"
68: string(11) "1.234000E+3"
69: string(11) "1.234000E+3"
70: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>