vprintf_basic9.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --TEST--
  2. Test vprintf() function : basic functionality - hexadecimal format
  3. --FILE--
  4. <?php
  5. /* Prototype : string vprintf(string $format , array $args)
  6. * Description: Output a formatted string
  7. * Source code: ext/standard/formatted_print.c
  8. */
  9. echo "*** Testing vprintf() : basic functionality - using hexadecimal format ***\n";
  10. // Initialising different format strings
  11. $format = "format";
  12. $format1 = "%x";
  13. $format2 = "%x %x";
  14. $format3 = "%x %x %x";
  15. $format11 = "%X";
  16. $format22 = "%X %X";
  17. $format33 = "%X %X %X";
  18. $arg1 = array(11);
  19. $arg2 = array(11,132);
  20. $arg3 = array(11,132,177);
  21. $result = vprintf($format1,$arg1);
  22. echo "\n";
  23. var_dump($result);
  24. $result = vprintf($format11,$arg1);
  25. echo "\n";
  26. var_dump($result);
  27. $result = vprintf($format2,$arg2);
  28. echo "\n";
  29. var_dump($result);
  30. $result = vprintf($format22,$arg2);
  31. echo "\n";
  32. var_dump($result);
  33. $result = vprintf($format3,$arg3);echo "\n";
  34. var_dump($result);
  35. $result = vprintf($format33,$arg3);
  36. echo "\n";
  37. var_dump($result);
  38. ?>
  39. ===DONE===
  40. --EXPECT--
  41. *** Testing vprintf() : basic functionality - using hexadecimal format ***
  42. b
  43. int(1)
  44. B
  45. int(1)
  46. b 84
  47. int(4)
  48. B 84
  49. int(4)
  50. b 84 b1
  51. int(7)
  52. B 84 B1
  53. int(7)
  54. ===DONE===