vfprintf_basic6.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Test vfprintf() function : basic functionality - exponential format
  3. --FILE--
  4. <?php
  5. /* Prototype : int vfprintf ( resource $handle , string $format , array $args )
  6. * Description: Write a formatted string to a stream
  7. * Source code: ext/standard/formatted_print.c
  8. */
  9. echo "*** Testing vfprintf() : basic functionality - using exponential format ***\n";
  10. // Initialise all required variables
  11. $format = "format";
  12. $format1 = "%e";
  13. $format2 = "%e %e";
  14. $format3 = "%e %e %e";
  15. $arg1 = array(1000);
  16. $arg2 = array(1000,2000);
  17. $arg3 = array(1000,2000,3000);
  18. /* creating dumping file */
  19. $data_file = dirname(__FILE__) . '/vfprintf_basic6.txt';
  20. if (!($fp = fopen($data_file, 'wt')))
  21. return;
  22. vfprintf($fp, $format1,$arg1);
  23. fprintf($fp, "\n");
  24. vfprintf($fp, $format2,$arg2);
  25. fprintf($fp, "\n");
  26. vfprintf($fp, $format3,$arg3);
  27. fprintf($fp, "\n");
  28. fclose($fp);
  29. print_r(file_get_contents($data_file));
  30. unlink($data_file);
  31. ?>
  32. ===DONE===
  33. --EXPECT--
  34. *** Testing vfprintf() : basic functionality - using exponential format ***
  35. 1.000000e+3
  36. 1.000000e+3 2.000000e+3
  37. 1.000000e+3 2.000000e+3 3.000000e+3
  38. ===DONE===