printf_basic7.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. --TEST--
  2. Test printf() function : basic functionality - unsigned format
  3. --SKIPIF--
  4. <?php
  5. if (PHP_INT_SIZE != 4) {
  6. die("skip this test is for 32bit platform only");
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. echo "*** Testing printf() : basic functionality - using unsigned format ***\n";
  12. // Initialise all required variables
  13. $format = "format";
  14. $format1 = "%u";
  15. $format2 = "%u %u";
  16. $format3 = "%u %u %u";
  17. $arg1 = -1111;
  18. $arg2 = -1234567;
  19. $arg3 = +2345432;
  20. echo "\n-- Calling printf() with no arguments --\n";
  21. $result = printf($format);
  22. echo "\n";
  23. var_dump($result);
  24. echo "\n-- Calling printf() with one arguments --\n";
  25. $result = printf($format1, $arg1);
  26. echo "\n";
  27. var_dump($result);
  28. echo "\n-- Calling printf() with two arguments --\n";
  29. $result = printf($format2, $arg1, $arg2);
  30. echo "\n";
  31. var_dump($result);
  32. echo "\n-- Calling printf() with three arguments --\n";
  33. $result = printf($format3, $arg1, $arg2, $arg3);
  34. echo "\n";
  35. var_dump($result);
  36. ?>
  37. --EXPECT--
  38. *** Testing printf() : basic functionality - using unsigned format ***
  39. -- Calling printf() with no arguments --
  40. format
  41. int(6)
  42. -- Calling printf() with one arguments --
  43. 4294966185
  44. int(10)
  45. -- Calling printf() with two arguments --
  46. 4294966185 4293732729
  47. int(21)
  48. -- Calling printf() with three arguments --
  49. 4294966185 4293732729 2345432
  50. int(29)