Array difference for multidimensional array with single array in php -


i want difference of multidimensional array single array. dont know whether possible or not. purpose find diference.

my first array contain username , mobile number

array1 ( array(lokesh,9687060900), array(mehul,9714959456), array(atish,9913400714), array(naitik,8735081680) ) 

array2(naitik,atish)

then want result

result( array(lokesh,9687060900), array(mehul,9714959456) ) 

i know function array_diff($a1,$a2); not solve problem. please refer me me find solution.

try this-

    $array1 = array(array('lokesh',9687060900),     array('mehul',9714959456),     array('atish',9913400714),     array('naitik',8735081680));      $array2 = ['naitik','atish'];      $result = [];         foreach($array1 $val2){          if(!in_array($val2[0], $array2)){             $result[] = $val2;         }     }  echo '<pre>'; print_r($result); 

hope you.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -