vfprintf_basic9.phpt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Test vfprintf) function : basic functionality - hexadecimal format
  3. --FILE--
  4. <?php
  5. echo "*** Testing vfprintf) : basic functionality - using hexadecimal format ***\n";
  6. // Initialising different format strings
  7. $format = "format";
  8. $format1 = "%x";
  9. $format2 = "%x %x";
  10. $format3 = "%x %x %x";
  11. $format11 = "%X";
  12. $format22 = "%X %X";
  13. $format33 = "%X %X %X";
  14. $arg1 = array(11);
  15. $arg2 = array(11,132);
  16. $arg3 = array(11,132,177);
  17. /* creating dumping file */
  18. $data_file = __DIR__ . '/vfprintf_basic9.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 hexadecimal format ***
  39. b
  40. B
  41. b 84
  42. B 84
  43. b 84 b1
  44. B 84 B1