I have an Object Array with few fields.
I was able to get the Array unique for this Object Array using below code:
$aa = array_unique($dd,SORT_REGULAR);
But what i am trying to achieve is, i want to exclude certain keys in object from "unique check". Lets say all object values are matching except "valid_from" and "valid_to" date fields.
Below is array structure:
Array
(
[9948] => stdClass Object
(
[payrate] => 78.00000
[valid_from] => 03/01/2017
[valid_to] => 03/31/2017
)
[15133] => stdClass Object
(
[payrate] => 78.00000
[valid_from] => 04/01/2017
[valid_to] => 04/31/2017
)
)
So as per above case as my pay rate is same in both object, but as valid from and valid to are different it will be still considered different entries.
Is there anyway we can specify exclude certain fields out for Array Unique for Array of Objects.