note 41208 added to function.strpos

From: Date: Fri, 02 Apr 2004 14:41:01 +0000
Subject: note 41208 added to function.strpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-67525@lists.php.net to get a copy of this message
You can use this function to find ANY occurence of a string in an array - no matter if it is just part of one of the array elements. it returns the key of the first found occurence or false function search_array($needle,$haystacks) { $found=false; foreach ($haystacks as $key => $haystack) { if (!(strpos($haystack,$needle)===false)) { $found=$key; break; } } return ($found); } ---- Manual Page -- http://www.php.net/manual/en/function.strpos.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41208 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41208&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41208&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67525) next »