vfprintf_basic3.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --TEST--
  2. Test vfprintf() function : basic functionality - float format
  3. --FILE--
  4. <?php
  5. echo "*** Testing vfprintf() : basic functionality - using float format ***\n";
  6. // Initialise all required variables
  7. $format = "format";
  8. $format1 = "%f";
  9. $format2 = "%f %f";
  10. $format3 = "%f %f %f";
  11. $format11 = "%F";
  12. $format22 = "%F %F";
  13. $format33 = "%F %F %F";
  14. $arg1 = array(11.11);
  15. $arg2 = array(11.11,22.22);
  16. $arg3 = array(11.11,22.22,33.33);
  17. /* creating dumping file */
  18. $data_file = __DIR__ . '/vfprintf_basic3.txt';
  19. if (!($fp = fopen($data_file, 'wt')))
  20. return;
  21. vfprintf($fp, $format1,$arg1);
  22. fprintf($fp, "\n");
  23. vfprintf($fp,$format11,$arg1);
  24. fprintf($fp, "\n");
  25. vfprintf($fp,$format2,$arg2);
  26. fprintf($fp, "\n");
  27. vfprintf($fp,$format22,$arg2);
  28. fprintf($fp, "\n");
  29. vfprintf($fp,$format3,$arg3);
  30. fprintf($fp, "\n");
  31. vfprintf($fp, $format33,$arg3);
  32. fprintf($fp, "\n");
  33. fclose($fp);
  34. print_r(file_get_contents($data_file));
  35. unlink($data_file);
  36. ?>
  37. --EXPECT--
  38. *** Testing vfprintf() : basic functionality - using float format ***
  39. 11.110000
  40. 11.110000
  41. 11.110000 22.220000
  42. 11.110000 22.220000
  43. 11.110000 22.220000 33.330000
  44. 11.110000 22.220000 33.330000