~ubuntu-branches/ubuntu/quantal/php5/quantal

« back to all changes in this revision

Viewing changes to ext/standard/tests/strings/vfprintf_basic5.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Sean Finney
  • Date: 2009-07-01 09:12:10 UTC
  • mto: (0.9.1) (1.1.17 upstream)
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: james.westby@ubuntu.com-20090701091210-go0h6506p62on17r
Tags: upstream-5.3.0
ImportĀ upstreamĀ versionĀ 5.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
Test vfprintf() function : basic functionality - char 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 char format ***\n";
 
11
 
 
12
// Initialise all required variables
 
13
$format = "format";
 
14
$format1 = "%c";
 
15
$format2 = "%c %c";
 
16
$format3 = "%c %c %c";
 
17
$arg1 = array(65);
 
18
$arg2 = array(65,66);
 
19
$arg3 = array(65,66,67);
 
20
 
 
21
/* creating dumping file */
 
22
$data_file = dirname(__FILE__) . '/dump.txt';
 
23
if (!($fp = fopen($data_file, 'wt')))
 
24
   return;
 
25
   
 
26
vfprintf($fp, $format1,$arg1);
 
27
fprintf($fp, "\n");
 
28
 
 
29
vfprintf($fp, $format2,$arg2);
 
30
fprintf($fp, "\n");
 
31
 
 
32
vfprintf($fp, $format3,$arg3);
 
33
fprintf($fp, "\n");
 
34
 
 
35
fclose($fp);
 
36
print_r(file_get_contents($data_file));
 
37
 
 
38
unlink($data_file);
 
39
?>
 
40
===DONE===
 
41
--EXPECT--
 
42
*** Testing vfprintf() : basic functionality - using char format ***
 
43
A
 
44
A B
 
45
A B C
 
46
===DONE===
 
47
 
 
48