I have an array like below:
Array
(
[0] => Array
(
[clearing] => 160000
[paydate] => 2016-08-03
[latecharge] => 900
)
[1] => Array
(
[clearing] => 160000
[paydate] => 2016-08-04
[latecharge] => 950
)
[2] => Array
(
[clearing] => 160001
[paydate] => 2016-08-05
[latecharge] => 850
)
)
I am trying to keep the latest paydate
of each clearing and remove the rest of the array.
For example, for clearing 160000, the latest paydate
is 2016-08-04 and for 160001 the latest paydate
is 2016-08-05 so my result array should be like below:
Array
(
[1] => Array
(
[clearing] => 160000
[paydate] => 2016-08-04
[latecharge] => 950
)
[2] => Array
(
[clearing] => 160001
[paydate] => 2016-08-05
[latecharge] => 850
)
)
How can I do this?