note 59013 added to function.array-search

From: Date: Wed, 23 Nov 2005 23:50:41 +0000
Subject: note 59013 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-99002@lists.php.net to get a copy of this message
Here's a little function I wrote to find the key of the LAST occurrance of something in an array. <?php if(!function_exists('array_rsearch')){ function array_rsearch($search, $array, $strict = false){ $array = array_reverse($array, true); foreach($array as $key => $value){ if($strict){ if($value === $search) return $key; } else { if(strpos($value, $search)) return $key; } } return false; } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59013 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59013&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59013&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59013&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59013&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59013&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59013&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59013&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59013&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99002) next »