Annotation of embedaddon/php/ext/standard/tests/strings/vfprintf_basic3.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test vfprintf() function : basic functionality - float format
3: --FILE--
4: <?php
5: /* Prototype : int vfprintf ( resource $handle , string $format , array $args )
6: * Description: Write a formatted string to a stream
7: * Source code: ext/standard/formatted_print.c
8: */
9:
10: echo "*** Testing vfprintf() : basic functionality - using float format ***\n";
11:
12: // Initialise all required variables
13:
14: $format = "format";
15: $format1 = "%f";
16: $format2 = "%f %f";
17: $format3 = "%f %f %f";
18:
19: $format11 = "%F";
20: $format22 = "%F %F";
21: $format33 = "%F %F %F";
22: $arg1 = array(11.11);
23: $arg2 = array(11.11,22.22);
24: $arg3 = array(11.11,22.22,33.33);
25:
26: /* creating dumping file */
27: $data_file = dirname(__FILE__) . '/dump.txt';
28: if (!($fp = fopen($data_file, 'wt')))
29: return;
30:
31: vfprintf($fp, $format1,$arg1);
32: fprintf($fp, "\n");
33:
34: vfprintf($fp,$format11,$arg1);
35: fprintf($fp, "\n");
36:
37: vfprintf($fp,$format2,$arg2);
38: fprintf($fp, "\n");
39:
40: vfprintf($fp,$format22,$arg2);
41: fprintf($fp, "\n");
42:
43: vfprintf($fp,$format3,$arg3);
44: fprintf($fp, "\n");
45:
46: vfprintf($fp, $format33,$arg3);
47: fprintf($fp, "\n");
48:
49: fclose($fp);
50: print_r(file_get_contents($data_file));
51:
52: unlink($data_file);
53: ?>
54: ===DONE===
55: --EXPECT--
56: *** Testing vfprintf() : basic functionality - using float format ***
57: 11.110000
58: 11.110000
59: 11.110000 22.220000
60: 11.110000 22.220000
61: 11.110000 22.220000 33.330000
62: 11.110000 22.220000 33.330000
63: ===DONE===
64:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>