note 55496 deleted from function.array-search by danbrown

From: Date: Wed, 29 Apr 2009 13:04:20 +0000
Subject: note 55496 deleted from function.array-search by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153992@lists.php.net to get a copy of this message
Note Submitter: ---- If you give a delimiter (or "glue") to implode() this because a little more robust. To use previous example with slight modification: $array2search = array("pat","ter","n"); $string = implode('|', $array2search); // now "pat|ter|n" if (strpos($string, "pattern" ) !== false) { // wont get here } Now, obviously if you search for strpos($string, "pat|ter|n"), you're going to have problems again... But using a delimiter like this should help avoid most if not all "unforseen" cases.

« previous php.notes (#153992) next »