Tags
Asked 3 years ago
9 Jun 2021
Views 250
kiran

kiran posted

how to search by value in multidimensional array in php ?

how to search by value in multidimensional array in php ?
Phpworker

Phpworker
answered Jan 21 '22 00:00

you can iterate the multidimensional array as belowed function :

function checkValue($array,$search){
        if(is_array($array)){
              foreach($array as $v){
                    if(is_array($array)){
                   if(checkValue($v,$search)==true){ return true;};
                   }else {
                      if($v==$search){return true;}  
                   
                }
             }
         }
return false;
}
Post Answer