1--TEST--
2Test vfprintf() function : basic functionality - string 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
10echo "*** Testing vfprintf() : basic functionality - using string format ***\n";
11
12// Initialise all required variables
13$format = "format";
14$format1 = "%s\n";
15$format2 = "%s %s\n";
16$format3 = "%s %s %s\n";
17$arg1 = array("one");
18$arg2 = array("one","two");
19$arg3 = array("one","two","three");
20
21
22/* creating dumping file */
23$data_file = dirname(__FILE__) . '/vfprintf_basic1.txt';
24if (!($fp = fopen($data_file, 'wt')))
25   return;
26
27$result = vfprintf($fp, $format1, $arg1);
28var_dump($result);
29$result = vfprintf($fp, $format2, $arg2);
30var_dump($result);
31$result = vfprintf($fp, $format3, $arg3);
32var_dump($result);
33
34fclose($fp);
35print_r(file_get_contents($data_file));
36
37unlink($data_file);
38
39?>
40===DONE===
41--EXPECT--
42*** Testing vfprintf() : basic functionality - using string format ***
43int(4)
44int(8)
45int(14)
46one
47one two
48one two three
49===DONE===
50