note 101955 deleted from function.array-search by danbrown

From: Date: Thu, 20 Jan 2011 14:53:14 +0000
Subject: note 101955 deleted from function.array-search by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-175934@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- The "code to replace" below (in the last note before the function) is slightly different. The last note should be: 9. if you want to get only the first location of $needle in $haystack, returned as an integer rather than array -- in other words, to make an array_match() function instead of array_match_all() -- remove this line: $results = array(); and replace: if ($found) { $results[] = $i; $i += $ncount - 1; } } if (empty($results)) return false; else return $results; with: if ($found) return $i; } return false;

« previous php.notes (#175934) next »