note 101955 added to function.array-search

From: Date: Wed, 19 Jan 2011 23:53:26 +0000
Subject: note 101955 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-175920@lists.php.net to get a copy of this message
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; ---- Server IP: 69.147.83.197 Probable Submitter: 95.107.219.213 ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- https://master.php.net/note/edit/101955 Del: integrated -- https://master.php.net/note/delete/101955/integrated Del: useless -- https://master.php.net/note/delete/101955/useless Del: bad code -- https://master.php.net/note/delete/101955/bad+code Del: spam -- https://master.php.net/note/delete/101955/spam Del: non-english -- https://master.php.net/note/delete/101955/non-english Del: in docs -- https://master.php.net/note/delete/101955/in+docs Del: other reasons-- https://master.php.net/note/delete/101955 Reject -- https://master.php.net/note/reject/101955 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#175920) next »