note 53489 added to function.array-search

From: Date: Fri, 03 Jun 2005 05:31:46 +0000
Subject: note 53489 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-89838@lists.php.net to get a copy of this message
If you don't need the power of recursive functions, and you want to just search within an array for the existence of a string pattern, you can always try this: if( strpos( implode( "", $array2search), "pattern" ) > -1 ) { // code to execute here } It's kind of lame and childish, but gets the job done in a pinch. Forgive me if someone else suggested this previously. I was racking my brain trying to do this using array_search(), in_array() and the like, and all I wanted was something dead simple. ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53489 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53489&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53489&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53489&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53489&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53489&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53489&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89838) next »