xref: /PHP-5.6/ext/ereg/tests/eregi_basic.phpt (revision 3f42f2f5)
1--TEST--
2Test 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/*
12 * Test basic functionality of eregi()
13 */
14
15echo "*** Testing eregi() : basic functionality ***\n";
16$string = <<<END
17UPPERCASE WORDS
18lowercase words
19MIxED CaSe woRdS
20END;
21
22var_dump(eregi('words', $string, $match1));
23var_dump($match1);
24
25var_dump(eregi('[[:lower:]]+[[:space:]]case', $string, $match2));  //character class lower should just match [a-z] but in case insensitive search matches [a-zA-Z]
26var_dump($match2);
27echo "Done";
28?>
29--EXPECTF--
30*** Testing eregi() : basic functionality ***
31
32Deprecated: Function eregi() is deprecated in %s on line %d
33int(5)
34array(1) {
35  [0]=>
36  string(5) "WORDS"
37}
38
39Deprecated: Function eregi() is deprecated in %s on line %d
40int(10)
41array(1) {
42  [0]=>
43  string(10) "MIxED CaSe"
44}
45Done
46