import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-strings / vprintf_variation9.php
blob0493e1cfd875d56c59fd134d8f182c5bed8f4147
1 <?php
2 /* Prototype : string vprintf(string format, array args)
3 * Description: Output a formatted string
4 * Source code: ext/standard/formatted_print.c
5 */
7 /*
8 * Test vprintf() for char formats with an array of chars passed to the function
9 */
11 echo "*** Testing vprintf() : char formats with char values ***\n";
14 // defining array of char formats
15 $formats = array(
16 "%c",
17 "%+c %-c %C",
18 "%lc %Lc, %4c %-4c",
19 "%10.4c %-10.4c %04c %04.4c",
20 "%'#2c %'2c %'$2c %'_2c",
21 "%c %c %c %c",
22 "% %%c c%",
23 '%3$c %4$c %1$c %2$c'
26 // Arrays of char values for the format defined in $format.
27 // Each sub array contains char values which correspond to each format string in $format
28 $args_array = array(
29 array(0),
30 array('c', 67, 68),
31 array(' ', " ", -67, +67),
32 array(97, -97, 98, +98),
33 array(97, -97, 98, +98),
34 array(0x123b, 0xfAb, 0123, 01293),
35 array(38, -1234, 2345),
36 array(67, 68, 65, 66)
40 // looping to test vprintf() with different char formats from the above $format array
41 // and with char values from the above $args_array array
42 $counter = 1;
43 foreach($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++;
52 ===DONE===