2 /* Prototype : string vprintf(string format, array args)
3 * Description: Output a formatted string
4 * Source code: ext/standard/formatted_print.c
8 * Test vprintf() when different octal formats and octal values are passed to
9 * the '$format' and '$args' arguments of the function
12 echo "*** Testing vprintf() : octal formats with octal values ***\n";
14 // defining array of octal formats
19 "%10.4o %-10.4o %04o %04.4o",
20 "%'#2o %'2o %'$2o %'_2o",
26 // Arrays of octal values for the format defined in $format.
27 // Each sub array contains octal values which correspond to each format string in $format
31 array(-020000000000, 020000000000, 017777777777, -017777777777),
32 array(0123456, 012345678, -01234567, 01234567),
33 array(0111, 02222, -0333333, -044444444),
34 array(0x123b, 0xfAb, 0123, 01293),
35 array(01234, 05678, -01234, 02345),
40 // looping to test vprintf() with different octal formats from the above $formats array
41 // and with octal values from the above $args_array array
43 foreach($formats as $format) {
44 echo "\n-- Iteration $counter --\n";
45 $result = vprintf($format, $args_array[$counter-1]);