[0] => Array
(
[event_date] => 2023-10-15
[sale_id] => 11959
[product_name] => 10x10 Commercial Pop-Up Tent | IMPACT Poly Top
[product_id] => 14
[qty_stock] => 3
[qty_booked] => 10
[qty_deficit] => -7
[eventDate] => 2023-10-13
[pickupDate] => 2023-10-16
)
[1] => Array
(
[event_date] => 2023-10-15
[sale_id] => 11959
[product_name] => 10x10 Commercial Pop-Up Tent | IMPACT Poly Top
[product_id] => 14
[qty_stock] => 3
[qty_booked] => 10
[qty_deficit] => -7
[eventDate] => 2023-10-15
[pickupDate] => 2023-10-15
)
I want olny one array element from here.
[0] => Array
(
[event_date] => 2023-10-15
[sale_id] => 11959
[product_name] => 10x10 Commercial Pop-Up Tent | IMPACT Poly Top
[product_id] => 14
[qty_stock] => 3
[qty_booked] => 10
[qty_deficit] => -7
[eventDate] => 2023-10-13
[pickupDate] => 2023-10-16
)
2
Answers
Possible duplicate of: PHP Removing duplicate objects from array
Accepted answer is also working on arrays.
An option could be to use a custom filter function like:
This of course requires that keys in your array elements always come in the same order and that you want to filter uniquely based on all keys.