vfprintf_basic4.phpt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Test vfprintf() function : basic functionality - bool 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 bool format ***\n";
  10. // Initialise all required variables
  11. $format = "format";
  12. $format1 = "%b";
  13. $format2 = "%b %b";
  14. $format3 = "%b %b %b";
  15. $arg1 = array(TRUE);
  16. $arg2 = array(TRUE,FALSE);
  17. $arg3 = array(TRUE,FALSE,TRUE);
  18. /* creating dumping file */
  19. $data_file = dirname(__FILE__) . '/vfprintf_basic4.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 bool format ***
  35. 1
  36. 1 0
  37. 1 0 1
  38. ===DONE===