I have the following code:
public function compareObjects($object1, $object2){
return $object1->id - $objects2->id
}
$diff = array_udiff($array1, $array2, 'compareObjects');
but it keeps saying that the compare method doesn’t exist or is an invalid function name….
I thought I did this right?
A method of an instantiated object is passed as an array containing an object at index 0 and the method name at index 1.
PHP: Callbacks