note 53958 deleted from function.array-search by felipe

From: Date: Sun, 10 Feb 2008 13:09:49 +0000
Subject: note 53958 deleted from function.array-search by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-135952@lists.php.net to get a copy of this message
Note Submitter: benoit at bh-services (dot) com ---- In answer to "info" at jake the spud dot com This code doesn't work in all cases and may have unexpected results. For example, it you have this code: $array2search = array("pat","ter", "n"); if( strpos( implode( "", $array2search), "pattern" ) > -1 ) { // You will be there ... but "pattern" does not exist in the array ... // something is wrong ! } There is no real solution using this code even if you try to enclose your elements by a special char ... because the special char could be part of the pattern. If it works for you, it won't work in all cases. /benoit

« previous php.notes (#135952) next »