strncasecmp_variation2.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --TEST--
  2. Test strncasecmp() function: usage variations - double quoted strings
  3. --FILE--
  4. <?php
  5. /* Test strncasecmp() function with various double quoted strings for 'str1', 'str2' */
  6. echo "*** Test strncasecmp() function: with double quoted strings ***\n";
  7. $strings = array(
  8. "Hello, World",
  9. "hello, world",
  10. "HELLO, WORLD",
  11. "Hello, World\n",
  12. "Hello".chr(0)."World"
  13. );
  14. /* loop through to compare each string with the other string */
  15. $count = 1;
  16. for($index1 = 0; $index1 < count($strings); $index1++) {
  17. echo "-- Iteration $count --\n";
  18. for($index2 = 0; $index2 < count($strings); $index2++) {
  19. var_dump( strncasecmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
  20. }
  21. $count ++;
  22. }
  23. echo "*** Done ***\n";
  24. ?>
  25. --EXPECTREGEX--
  26. \*\*\* Test strncasecmp\(\) function: with double quoted strings \*\*\*
  27. -- Iteration 1 --
  28. int\(0\)
  29. int\(0\)
  30. int\(0\)
  31. int\(-[1-9][0-9]*\)
  32. int\([1-9][0-9]*\)
  33. -- Iteration 2 --
  34. int\(0\)
  35. int\(0\)
  36. int\(0\)
  37. int\(-[1-9][0-9]*\)
  38. int\([1-9][0-9]*\)
  39. -- Iteration 3 --
  40. int\(0\)
  41. int\(0\)
  42. int\(0\)
  43. int\(-[1-9][0-9]*\)
  44. int\([1-9][0-9]*\)
  45. -- Iteration 4 --
  46. int\([1-9][0-9]*\)
  47. int\([1-9][0-9]*\)
  48. int\([1-9][0-9]*\)
  49. int\(0\)
  50. int\([1-9][0-9]*\)
  51. -- Iteration 5 --
  52. int\(-[1-9][0-9]*\)
  53. int\(-[1-9][0-9]*\)
  54. int\(-[1-9][0-9]*\)
  55. int\(-[1-9][0-9]*\)
  56. int\(0\)
  57. \*\*\* Done \*\*\*