note 109515 added to function.in-array

From: Date: Tue, 24 Jul 2012 18:43:05 +0000
Subject: note 109515 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-189388@lists.php.net to get a copy of this message
version of in_array that searches by regular expression. Don't forget to preg_quote() your search term. <?php function in_array_match($regex, $array) { if (!is_array($array)) trigger_error('Argument 2 must be array'); foreach ($array as $v) { $match = preg_match($regex, $v); if ($match === 1) { return true; } } return false; } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 24.89.139.58 ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit -- https://master.php.net/note/edit/109515 Del: integrated -- https://master.php.net/note/delete/109515/integrated Del: useless -- https://master.php.net/note/delete/109515/useless Del: bad code -- https://master.php.net/note/delete/109515/bad+code Del: spam -- https://master.php.net/note/delete/109515/spam Del: non-english -- https://master.php.net/note/delete/109515/non-english Del: in docs -- https://master.php.net/note/delete/109515/in+docs Del: other reasons-- https://master.php.net/note/delete/109515 Reject -- https://master.php.net/note/reject/109515 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189388) next »