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
9echo "*** Testing vprintf() : with  white spaces in format strings ***\n";
10
11// initializing the format array
12$formats = array(
13  "% d  %  d  %   d",
14  "% f  %  f  %   f",
15  "% F  %  F  %   F",
16  "% b  %  b  %   b",
17  "% c  %  c  %   c",
18  "% e  %  e  %   e",
19  "% u  %  u  %   u",
20  "% o  %  o  %   o",
21  "% x  %  x  %   x",
22  "% X  %  X  %   X",
23  "% E  %  E  %   E"
24);
25
26// initializing the args array
27
28$args_array = array(
29  array(111, 222, 333),
30  array(1.1, .2, -0.6),
31  array(1.12, -1.13, +0.23),
32  array(1, 2, 3),
33  array(65, 66, 67),
34  array(2e1, 2e-1, -2e1),
35  array(-11, +22, 33),
36  array(012, -023, +023),
37  array(0x11, -0x22, +0x33),
38  array(0x11, -0x22, +0x33),
39  array(2e1, 2e-1, -2e1)
40);
41
42$counter = 1;
43foreach($formats as $format) {
44  echo"\n-- Iteration $counter --\n";
45  $result = vprintf($format, $args_array[$counter-1]);
46  echo "\n";
47  var_dump($result);
48  $counter++;
49}
50
51?>
52--EXPECT--
53*** Testing vprintf() : with  white spaces in format strings ***
54
55-- Iteration 1 --
56111  222  333
57int(13)
58
59-- Iteration 2 --
601.100000  0.200000  -0.600000
61int(29)
62
63-- Iteration 3 --
641.120000  -1.130000  0.230000
65int(29)
66
67-- Iteration 4 --
681  10  11
69int(9)
70
71-- Iteration 5 --
72A  B  C
73int(7)
74
75-- Iteration 6 --
762.000000e+1  2.000000e-1  -2.000000e+1
77int(38)
78
79-- Iteration 7 --
804294967285  22  33
81int(18)
82
83-- Iteration 8 --
8412  37777777755  23
85int(19)
86
87-- Iteration 9 --
8811  ffffffde  33
89int(16)
90
91-- Iteration 10 --
9211  FFFFFFDE  33
93int(16)
94
95-- Iteration 11 --
962.000000E+1  2.000000E-1  -2.000000E+1
97int(38)
98