vsprintf_basic3.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. Test vsprintf() function : basic functionality - float format
  3. --FILE--
  4. <?php
  5. /* Prototype : string vsprintf(string $format , array $args)
  6. * Description: Return a formatted string
  7. * Source code: ext/standard/formatted_print.c
  8. */
  9. echo "*** Testing vsprintf() : 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. var_dump( vsprintf($format1,$arg1) );
  22. var_dump( vsprintf($format11,$arg1) );
  23. var_dump( vsprintf($format2,$arg2) );
  24. var_dump( vsprintf($format22,$arg2) );
  25. var_dump( vsprintf($format3,$arg3) );
  26. var_dump( vsprintf($format33,$arg3) );
  27. echo "Done";
  28. ?>
  29. --EXPECTF--
  30. *** Testing vsprintf() : basic functionality - using float format ***
  31. string(9) "11.110000"
  32. string(9) "11.110000"
  33. string(19) "11.110000 22.220000"
  34. string(19) "11.110000 22.220000"
  35. string(29) "11.110000 22.220000 33.330000"
  36. string(29) "11.110000 22.220000 33.330000"
  37. Done