note 47134 added to function.in-array

From: Date: Thu, 04 Nov 2004 10:13:07 +0000
Subject: note 47134 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-79589@lists.php.net to get a copy of this message
Hi, if you want to search a value in a mutidimensional array try this. Cu Christoph ------------------------------- <? function in_multi_array($search_str, $multi_array) { if(!is_array($multi_array)) return 0; if(in_array($search_str, $multi_array)) return 1; foreach($multi_array as $key => $value) { if(is_array($value)) { $found = in_multi_array($search_str, $value); if($found) return 1; } else { if($key==$search_str) return 1; } } return 0; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47134 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47134&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47134&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47134&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47134&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47134&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47134&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47134&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#79589) next »