import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-strings / vprintf_variation17.php
blob5b9a47df447decbc47509faaac070acbd7239e78
1 <?php
2 /* Prototype : string vsprintf(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 scientific formats and scientific values
9 * are passed to the '$format' and '$args' arguments of the function
12 echo "*** Testing vprintf() : scientific formats and scientific values ***\n";
14 // defining array of scientific formats
15 $formats = array(
16 '%e %+e %-e',
17 '%le %Le %4e %-4e',
18 '%10.4e %-10.4e %.4e',
19 '%\'#20e %\'20e %\'$20e %\'_20e',
20 '%3$e %4$e %1$e %2$e'
23 // Arrays of scientific values for the format defined in $format.
24 // Each sub array contains scientific values which correspond to each format string in $format
25 $args_array = array(
26 array(0, 1e0, "10e2" ),
27 array(2.2e2, 10e10, 1000e-2, 1000e7),
28 array(-22e12, 10e20, 1.2e2),
29 array(1e1, +1e2, -1e3, "1e2_"),
30 array(3e3, 4e3, 1e3, 2e3)
33 // looping to test vprintf() with different scientific formats from the above $format array
34 // and with signed and other types of values from the above $args_array array
35 $counter = 1;
36 foreach($formats as $format) {
37 echo "\n-- Iteration $counter --\n";
38 $result = vprintf($format, $args_array[$counter-1]);
39 echo "\n";
40 var_dump($result);
41 $counter++;
45 ===DONE===