difference between two array using php -


i having 2 array following ,

$a =array(1,2,3,4); $b =array(1,2,5,6); 

here mycode

$c=array_diff($a,$b); $c=array(3,4,5,6); 

but want following

$c=array(3,4); 

note:

i want $a array value not present in $b array.

try

<?php $array1 = array(1,2,3,4); $array2 = array(1,2,5,6); $result = array_diff($array1, $array2);  print_r($result); ?> 

read php.net array_diff , refer fiddle


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -