note 101001 added to function.in-array

From: Date: Fri, 19 Nov 2010 13:48:46 +0000
Subject: note 101001 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-174190@lists.php.net to get a copy of this message
bogdan AT bogdanconstantinescu DOT com example of searching in a multidimensional array works as long as you don't set the Array keys yourself. If you need to search a multidimensional array where you have used text keys then try this - function in_marray($elem, $array) { foreach($array as $key=>$value) { if($value === $elem) { return true; } else { if(is_array($value)) { if(in_marray($elem, ($value))) { return true; } } } } return false; } ---- Server IP: 87.124.126.135 Probable Submitter: 78.143.213.243 (proxied: 78.143.213.243) ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit -- https://master.php.net/note/edit/101001 Del: integrated -- https://master.php.net/note/delete/101001/integrated Del: useless -- https://master.php.net/note/delete/101001/useless Del: bad code -- https://master.php.net/note/delete/101001/bad+code Del: spam -- https://master.php.net/note/delete/101001/spam Del: non-english -- https://master.php.net/note/delete/101001/non-english Del: in docs -- https://master.php.net/note/delete/101001/in+docs Del: other reasons-- https://master.php.net/note/delete/101001 Reject -- https://master.php.net/note/reject/101001 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174190) next »