vfprintf_basic8.phpt 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Test vfprintf() function : basic functionality - octal 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 octal format ***\n";
  10. // Initialise all required variables
  11. $format = "format";
  12. $format1 = "%o";
  13. $format2 = "%o %o";
  14. $format3 = "%o %o %o";
  15. $arg1 = array(021);
  16. $arg2 = array(021,0347);
  17. $arg3 = array(021,0347,05678);
  18. /* creating dumping file */
  19. $data_file = dirname(__FILE__) . '/vfprintf_basic8.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 octal format ***
  35. 21
  36. 21 347
  37. 21 347 567
  38. ===DONE===