import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-strings / vprintf_variation11_64bit.php
blobf71d82c612b6345a45f4aad3b4542e4a23fc0f86
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() 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
15 $formats = array(
16 "%o",
17 "%+o %-o %O",
18 "%lo %Lo, %4o %-4o",
19 "%10.4o %-10.4o %04o %04.4o",
20 "%'#2o %'2o %'$2o %'_2o",
21 "%o %o %o %o",
22 "%% %%o %10 o%",
23 '%3$o %4$o %1$o %2$o'
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
28 $args_array = array(
29 array(00),
30 array(-01, 01, +022),
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),
36 array(03, 04, 01, 02)
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
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===