xref: /PHP-8.0/ext/pcre/tests/grep.phpt (revision c93dc5d8)
1--TEST--
2preg_grep()
3--FILE--
4<?php
5$array = array('a', '1', 'q6', 'h20');
6
7var_dump(preg_grep('/^(\d|.\d)$/', $array));
8var_dump(preg_grep('/^(\d|.\d)$/', $array, PREG_GREP_INVERT));
9
10?>
11--EXPECT--
12array(2) {
13  [1]=>
14  string(1) "1"
15  [2]=>
16  string(2) "q6"
17}
18array(2) {
19  [0]=>
20  string(1) "a"
21  [3]=>
22  string(3) "h20"
23}
24