compare two arrays and return the difference php
array_merge(array_diff($array1,$array2),array_diff($array2,$array1))
compare two arrays and return the difference php
array_merge(array_diff($array1,$array2),array_diff($array2,$array1))
php compare two arrays of objects
// Computes the difference of arrays by using a callback function for data comparison. This is unlike array_diff() which uses an internal function for comparing the data.
function compare_objects($obj_a, $obj_b) {
return $obj_a->id - $obj_b->id;
}
$diff = array_udiff($first_array, $second_array, 'compare_objects');
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us