vfprintf_basic2.phpt 905 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. Test vfprintf() function : basic functionality - integer format
  3. --FILE--
  4. <?php
  5. /*
  6. * Testing vfprintf() : basic functionality - using integer format
  7. */
  8. echo "*** Testing vfprintf() : basic functionality - using integer format ***\n";
  9. // Initialise all required variables
  10. $format = "format";
  11. $format1 = "%d";
  12. $format2 = "%d %d";
  13. $format3 = "%d %d %d";
  14. $arg1 = array(111);
  15. $arg2 = array(111,222);
  16. $arg3 = array(111,222,333);
  17. /* creating dumping file */
  18. $data_file = __DIR__ . '/vfprintf_basic2.txt';
  19. if (!($fp = fopen($data_file, 'wt')))
  20. return;
  21. vfprintf($fp, $format1, $arg1);
  22. fprintf($fp, "\n");
  23. vfprintf($fp, $format2, $arg2);
  24. fprintf($fp, "\n");
  25. vfprintf($fp, $format3, $arg3);
  26. fprintf($fp, "\n");
  27. fclose($fp);
  28. print_r(file_get_contents($data_file));
  29. unlink($data_file);
  30. ?>
  31. --EXPECT--
  32. *** Testing vfprintf() : basic functionality - using integer format ***
  33. 111
  34. 111 222
  35. 111 222 333