vsprintf_basic9.phpt 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. Test vsprintf() function : basic functionality - hexadecimal format
  3. --FILE--
  4. <?php
  5. /* Prototype : string vsprintf(string $format , array $args)
  6. * Description: Return a formatted string
  7. * Source code: ext/standard/formatted_print.c
  8. */
  9. echo "*** Testing vsprintf() : 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. var_dump( vsprintf($format1,$arg1) );
  22. var_dump( vsprintf($format11,$arg1) );
  23. var_dump( vsprintf($format2,$arg2) );
  24. var_dump( vsprintf($format22,$arg2) );
  25. var_dump( vsprintf($format3,$arg3) );
  26. var_dump( vsprintf($format33,$arg3) );
  27. echo "Done";
  28. ?>
  29. --EXPECTF--
  30. *** Testing vsprintf() : basic functionality - using hexadecimal format ***
  31. string(1) "b"
  32. string(1) "B"
  33. string(4) "b 84"
  34. string(4) "B 84"
  35. string(7) "b 84 b1"
  36. string(7) "B 84 B1"
  37. Done