vprintf_basic2.phpt 939 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Test vprintf() function : basic functionality - integer format
  3. --FILE--
  4. <?php
  5. /* Prototype : string vprintf(string $format , array $args)
  6. * Description: Output a formatted string
  7. * Source code: ext/standard/formatted_print.c
  8. */
  9. /*
  10. * Testing vprintf() : basic functionality - using integer format
  11. */
  12. echo "*** Testing vprintf() : basic functionality - using integer format ***\n";
  13. // Initialise all required variables
  14. $format = "format";
  15. $format1 = "%d";
  16. $format2 = "%d %d";
  17. $format3 = "%d %d %d";
  18. $arg1 = array(111);
  19. $arg2 = array(111,222);
  20. $arg3 = array(111,222,333);
  21. $result = vprintf($format1,$arg1);
  22. echo "\n";
  23. var_dump($result);
  24. $result = vprintf($format2,$arg2);
  25. echo "\n";
  26. var_dump($result);
  27. $result = vprintf($format3,$arg3);
  28. echo "\n";
  29. var_dump($result);
  30. ?>
  31. ===DONE===
  32. --EXPECT--
  33. *** Testing vprintf() : basic functionality - using integer format ***
  34. 111
  35. int(3)
  36. 111 222
  37. int(7)
  38. 111 222 333
  39. int(11)
  40. ===DONE===