strnatcasecmp_variation1.phpt 705 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --TEST--
  2. Test strnatcasecmp() function : variation
  3. --CREDITS--
  4. Felix De Vliegher <felix.devliegher@gmail.com>
  5. --FILE--
  6. <?php
  7. /* Preparation */
  8. class a
  9. {
  10. function __toString()
  11. {
  12. return "Hello WORLD";
  13. }
  14. }
  15. class b
  16. {
  17. function __toString()
  18. {
  19. return "HELLO world";
  20. }
  21. }
  22. $a = new a();
  23. $b = new b();
  24. function str_dump($a, $b) {
  25. var_dump(strnatcasecmp($a, $b));
  26. }
  27. echo "*** Testing strnatcasecmp() : variation ***\n";
  28. str_dump('0', false);
  29. str_dump('fooBar', '');
  30. str_dump('', -1);
  31. str_dump("Hello\0world", "Helloworld");
  32. str_dump("\x0", "\0");
  33. str_dump($a, $b);
  34. ?>
  35. --EXPECT--
  36. *** Testing strnatcasecmp() : variation ***
  37. int(1)
  38. int(1)
  39. int(-1)
  40. int(-1)
  41. int(0)
  42. int(0)