vprintf_basic3.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --TEST--
  2. Test vprintf() function : basic functionality - float 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. echo "*** Testing vprintf() : basic functionality - using float format ***\n";
  10. // Initialise all required variables
  11. $format = "format";
  12. $format1 = "%f";
  13. $format2 = "%f %f";
  14. $format3 = "%f %f %f";
  15. $format11 = "%F";
  16. $format22 = "%F %F";
  17. $format33 = "%F %F %F";
  18. $arg1 = array(11.11);
  19. $arg2 = array(11.11,22.22);
  20. $arg3 = array(11.11,22.22,33.33);
  21. $result = vprintf($format1,$arg1);
  22. echo "\n";
  23. var_dump($result);
  24. $result = vprintf($format11,$arg1);
  25. echo "\n";
  26. var_dump($result);
  27. $result = vprintf($format2,$arg2);
  28. echo "\n";
  29. var_dump($result);
  30. $result = vprintf($format22,$arg2);
  31. echo "\n";
  32. var_dump($result);
  33. $result = vprintf($format3,$arg3);
  34. echo "\n";
  35. var_dump($result);
  36. $result = vprintf($format33,$arg3);
  37. echo "\n";
  38. var_dump($result);
  39. ?>
  40. ===DONE===
  41. --EXPECT--
  42. *** Testing vprintf() : basic functionality - using float format ***
  43. 11.110000
  44. int(9)
  45. 11.110000
  46. int(9)
  47. 11.110000 22.220000
  48. int(19)
  49. 11.110000 22.220000
  50. int(19)
  51. 11.110000 22.220000 33.330000
  52. int(29)
  53. 11.110000 22.220000 33.330000
  54. int(29)
  55. ===DONE===