(PHP 4, PHP 5, PHP 7)
preg_grep — 锟斤拷锟斤拷匹锟斤拷模式锟斤拷锟斤拷锟斤拷锟斤拷目
$pattern
, array $input
[, int $flags
= 0
] ) : array
锟斤拷锟截革拷锟斤拷锟斤拷锟斤拷input
锟斤拷锟斤拷模式pattern
匹锟斤拷锟皆拷锟斤拷锟缴碉拷锟斤拷锟斤拷.
pattern
要锟斤拷锟斤拷锟斤拷模式, 锟街凤拷锟斤拷锟斤拷式.
input
锟斤拷锟斤拷锟斤拷锟斤拷.
flags
锟斤拷锟斤拷锟斤拷锟轿�PREG_GREP_INVERT
, 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
锟斤拷锟斤拷模式pattern
锟斤拷匹锟斤拷锟皆拷锟斤拷锟缴碉拷锟斤拷锟斤拷.
锟斤拷锟斤拷使锟斤拷input
锟斤拷key锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷.
Example #1 preg_grep() 示锟斤拷
<?php
// 锟斤拷锟斤拷锟斤拷锟叫帮拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷元锟斤拷
$fl_array = preg_grep("/^(\d+)?\.\d+$/", $array);
?>