printf_basic4.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --TEST--
  2. Test printf() function : basic functionality - bool format
  3. --FILE--
  4. <?php
  5. echo "*** Testing printf() : basic functionality - using bool format ***\n";
  6. // Initialise all required variables
  7. $format = "format";
  8. $format1 = "%b";
  9. $format2 = "%b %b";
  10. $format3 = "%b %b %b";
  11. $arg1 = TRUE;
  12. $arg2 = FALSE;
  13. $arg3 = true;
  14. echo "\n-- Calling printf() with no arguments --\n";
  15. $result = printf($format);
  16. echo "\n";
  17. var_dump($result);
  18. echo "\n-- Calling printf() with one arguments--\n";
  19. $result = printf($format1, $arg1);
  20. echo "\n";
  21. var_dump($result);
  22. echo "\n-- Calling printf() with two arguments--\n";
  23. $result = printf($format2, $arg1, $arg2);
  24. echo "\n";
  25. var_dump($result);
  26. echo "\n-- Calling printf() with three arguments--\n";
  27. $result = printf($format3, $arg1, $arg2, $arg3);
  28. echo "\n";
  29. var_dump($result);
  30. ?>
  31. --EXPECT--
  32. *** Testing printf() : basic functionality - using bool format ***
  33. -- Calling printf() with no arguments --
  34. format
  35. int(6)
  36. -- Calling printf() with one arguments--
  37. 1
  38. int(1)
  39. -- Calling printf() with two arguments--
  40. 1 0
  41. int(3)
  42. -- Calling printf() with three arguments--
  43. 1 0 1
  44. int(5)