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