How to check one json array value is present or not in another array using PHP -


i need 1 help. need verify weather 1 json array value present inside array or not using php. explaining code below.

$img=array(     array("iamge"=>"1234_asd.jpg"),     array("iamge"=>"1235_ase.jpg"),     array("iamge"=>"1236_asf.jpg") ); $imgarr=array(     array("iamgename"=>"1234_asd.jpg"),     array("iamgename"=>"1235_ase.jpg"),     array("iamgename"=>"1236_asf.jpg"),     array("iamgename"=>"1237_asg.jpg") );  

here have 2 array. need check of value $imgarr array present inside $img array or not.in case value not present return false image name , if present return omlu true. please me.

function bjsearch($img, $seachimg){     $result = true;     if(!in_array($seachimg, $img)){        $result = false;     }     return $result; }   $found = true; $image_name = ''; foreach($imgarr $k=>$im){     $seachinarr = isset($img[$k]) ? $img[$k] : array();     $res = bjsearch($seachinarr, $im['iamgename']);     if($res === false){        $found = false;        $image_name = $im['iamgename'];     } } var_dump($found, $image_name); 

working example: https://3v4l.org/vkaf4


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -