note 114628 deleted from function.in-array by levim

From: Date: Tue, 18 Mar 2014 02:58:56 +0000
Subject: note 114628 deleted from function.in-array by levim
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198943@lists.php.net to get a copy of this message
Note Submitter: douglasnoronha at hotmail dot com dot br ---- Verificar se um valor existe em um array multidimensional $array = array('casa','carro','barco',); $value = "casa"; function multi_array($value,$array){ foreach($array as $arrays){ if(in_array($value,$arrays)){ return true; } } return false; } if(multi_array($value,$array)){ echo $value." existe no array."; } else{ echo $value." não existe no array."; } A saída será: casa existe no array.

« previous php.notes (#198943) next »