Annotation of embedaddon/php/ext/pcre/tests/grep2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: preg_grep() 2nd test
3: --FILE--
4: <?php
5:
6: var_dump(preg_grep(1,array(),3,4));
7: var_dump(preg_grep(1, 2));
8: var_dump(preg_grep('/+/', array()));
9:
10: $array = array(5=>'a', 'x' => '1', 'xyz'=>'q6', 'h20');
11:
12: var_dump(preg_grep('@^[a-z]+@', $array));
13: var_dump(preg_grep('@^[a-z]+@', $array, PREG_GREP_INVERT));
14:
15: ini_set('pcre.recursion_limit', 1);
16: var_dump(preg_last_error() == PREG_NO_ERROR);
17: var_dump(preg_grep('@^[a-z]+@', $array));
18: var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR);
19:
20: ?>
21: --EXPECTF--
22: Warning: preg_grep() expects at most 3 parameters, 4 given in %sgrep2.php on line 3
23: NULL
24:
25: Warning: preg_grep() expects parameter 2 to be array, integer given in %sgrep2.php on line 4
26: NULL
27:
28: Warning: preg_grep(): Compilation failed: nothing to repeat at offset 0 in %sgrep2.php on line 5
29: bool(false)
30: array(3) {
31: [5]=>
32: string(1) "a"
33: ["xyz"]=>
34: string(2) "q6"
35: [6]=>
36: string(3) "h20"
37: }
38: array(1) {
39: ["x"]=>
40: string(1) "1"
41: }
42: bool(true)
43: array(0) {
44: }
45: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>