1--TEST--
2Test vprintf() function : usage variations - with whitespaces in format strings
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
6?>
7--FILE--
8<?php
9/* Prototype  : string vprintf(string $format , array $args)
10 * Description: Output a formatted string
11 * Source code: ext/standard/formatted_print.c
12*/
13
14echo "*** Testing vprintf() : with  white spaces in format strings ***\n";
15
16// initializing the format array
17$formats = array(
18  "% d  %  d  %   d",
19  "% f  %  f  %   f",
20  "% F  %  F  %   F",
21  "% b  %  b  %   b",
22  "% c  %  c  %   c",
23  "% e  %  e  %   e",
24  "% u  %  u  %   u",
25  "% o  %  o  %   o",
26  "% x  %  x  %   x",
27  "% X  %  X  %   X",
28  "% E  %  E  %   E"
29);
30
31// initializing the args array
32
33$args_array = array(
34  array(111, 222, 333),
35  array(1.1, .2, -0.6),
36  array(1.12, -1.13, +0.23),
37  array(1, 2, 3),
38  array(65, 66, 67),
39  array(2e1, 2e-1, -2e1),
40  array(-11, +22, 33),
41  array(012, -023, +023),
42  array(0x11, -0x22, +0x33),
43  array(0x11, -0x22, +0x33),
44  array(2e1, 2e-1, -2e1)
45);
46
47$counter = 1;
48foreach($formats as $format) {
49  echo"\n-- Iteration $counter --\n";
50  $result = vprintf($format, $args_array[$counter-1]);
51  echo "\n";
52  var_dump($result);
53  $counter++;
54}
55
56?>
57===DONE===
58--EXPECT--
59*** Testing vprintf() : with  white spaces in format strings ***
60
61-- Iteration 1 --
62111  222  333
63int(13)
64
65-- Iteration 2 --
661.100000  0.200000  -0.600000
67int(29)
68
69-- Iteration 3 --
701.120000  -1.130000  0.230000
71int(29)
72
73-- Iteration 4 --
741  10  11
75int(9)
76
77-- Iteration 5 --
78A  B  C
79int(7)
80
81-- Iteration 6 --
822.000000e+1  2.000000e-1  -2.000000e+1
83int(38)
84
85-- Iteration 7 --
864294967285  22  33
87int(18)
88
89-- Iteration 8 --
9012  37777777755  23
91int(19)
92
93-- Iteration 9 --
9411  ffffffde  33
95int(16)
96
97-- Iteration 10 --
9811  FFFFFFDE  33
99int(16)
100
101-- Iteration 11 --
1022.000000E+1  2.000000E-1  -2.000000E+1
103int(38)
104===DONE===
105