strncasecmp_variation8.phpt 1.1 KB

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