note 85503 deleted from function.preg-grep by joey

From: Date: Mon, 02 Nov 2015 15:42:52 +0000
Subject: note 85503 deleted from function.preg-grep by joey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-204071@lists.php.net to get a copy of this message
Note Submitter: brian at cristina dot org ---- I don't see it mentioned here but you can invert your match to only return array entries where the search values IS NOT found. The format for it is... <?php $nomatch = preg_grep("/{$keyword}/i",$array,PREG_GREP_INVERT); ?> Notice the PREG_GREP_INVERT. That will result in an array ($nomatch) that contains all entries of $array where $keyword IS NOT found. Hope that helps! -b

« previous php.notes (#204071) next »