Comparing Associative array and standard array PHP -


i have 2 arrays

array1:

array ( [0] => array ( [0] => 3 [1] => 1 [2] => 4 ) [1] => array ( [0] => 1 [1] => 6 ) ) 

array2:

array ( [0] => 1 [1] => 3 [2] => 2 ) 

i used array_diff comparing , getting difference values, same key coming ie.,

array_diff(array1,array2) 

returns array([0] =>3 [2] => 4)

but there other way difference , having result

array([0] =>3 [1] => 4)..

assuming you've got array_diff working on multidimensional array somehow, docs:

this function checks 1 dimension of n-dimensional array. of course can check deeper dimensions using array_diff($array1[0], $array2[0]);.

use array_values around it.

array_values(array_diff($array1, $array2)); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -