eregi_basic.phpt 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. Test eregi() function : basic functionality - confirm case insensitivity
  3. --FILE--
  4. <?php
  5. /* Prototype : proto int eregi(string pattern, string string [, array registers])
  6. * Description: Case-insensitive regular expression match
  7. * Source code: ext/standard/reg.c
  8. * Alias to functions:
  9. */
  10. /*
  11. * Test basic functionality of eregi()
  12. */
  13. echo "*** Testing eregi() : basic functionality ***\n";
  14. $string = <<<END
  15. UPPERCASE WORDS
  16. lowercase words
  17. MIxED CaSe woRdS
  18. END;
  19. var_dump(eregi('words', $string, $match1));
  20. var_dump($match1);
  21. var_dump(eregi('[[:lower:]]+[[:space:]]case', $string, $match2)); //character class lower should just match [a-z] but in case insensitive search matches [a-zA-Z]
  22. var_dump($match2);
  23. echo "Done";
  24. ?>
  25. --EXPECTF--
  26. *** Testing eregi() : basic functionality ***
  27. Deprecated: Function eregi() is deprecated in %s on line %d
  28. int(5)
  29. array(1) {
  30. [0]=>
  31. string(5) "WORDS"
  32. }
  33. Deprecated: Function eregi() is deprecated in %s on line %d
  34. int(10)
  35. array(1) {
  36. [0]=>
  37. string(10) "MIxED CaSe"
  38. }
  39. Done