sscanf_basic6.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Test sscanf() 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 sscanf() : basic functionality - using unsigned format ***\n";
  12. $str = "-11 +11 11 -11.234 +11.234 11.234";
  13. $format = "%u %u %u %u %u %u";
  14. echo "\n-- Try sccanf() WITHOUT optional args --\n";
  15. // extract details using short format
  16. list($arg1, $arg2, $arg3, $arg4, $arg5, $arg6) = sscanf($str, $format);
  17. var_dump($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
  18. echo "\n-- Try sccanf() WITH optional args --\n";
  19. // extract details using long format
  20. $res = sscanf($str, $format, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
  21. var_dump($res, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
  22. ?>
  23. --EXPECT--
  24. *** Testing sscanf() : basic functionality - using unsigned format ***
  25. -- Try sccanf() WITHOUT optional args --
  26. string(10) "4294967285"
  27. int(11)
  28. int(11)
  29. string(10) "4294967285"
  30. NULL
  31. NULL
  32. -- Try sccanf() WITH optional args --
  33. int(4)
  34. string(10) "4294967285"
  35. int(11)
  36. int(11)
  37. string(10) "4294967285"
  38. NULL
  39. NULL