note 85503 added to function.preg-grep
| From: | brian at cristina dot org | Date: | Tue, 02 Sep 2008 20:31:53 +0000 |
| Subject: | note 85503 added to function.preg-grep | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144092@lists.php.net to get a copy of this message | ||
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
----
Server IP: 64.71.164.2
Probable Submitter: 67.168.10.2
----
Manual Page -- http://www.php.net/manual/en/function.preg-grep.php
Edit -- https://master.php.net/note/edit/85503
Del: integrated -- https://master.php.net/note/delete/85503/integrated
Del: useless -- https://master.php.net/note/delete/85503/useless
Del: bad code -- https://master.php.net/note/delete/85503/bad+code
Del: spam -- https://master.php.net/note/delete/85503/spam
Del: non-english -- https://master.php.net/note/delete/85503/non-english
Del: in docs -- https://master.php.net/note/delete/85503/in+docs
Del: other reasons-- https://master.php.net/note/delete/85503
Reject -- https://master.php.net/note/reject/85503
Search -- https://master.php.net/manage/user-notes.php