我有一个数组。在做了一些条件后,我得到的数组如下所示。
Array
(
[2] => Array
(
[OriginEventId] => 0152c945-e15b-48f9-8a0e-e4b9eace4731
[Description] => Pension Reversion
[transaction_date] => 2014-10-30T00:00:00
[transaction_amount] => -1129794.96
[member_id] => 1
[type] => InternalTransfers
[transaction_type] => Accumulation
)
[13] => Array
(
[OriginEventId] => 0152c945-e15b-48f9-8a0e-e4b9eace4731
[Description] => Pension Reversion
[transaction_date] => 2014-10-30T00:00:00
[transaction_amount] => 1129794.96
[member_id] => 1
[type] => PensionsRolledBack
[transaction_type] => Accumulation
)
[23] => Array
(
[OriginEventId] => 0152c945-e15b-48f9-8a0e-e4b9eace4731
[Description] => Pension Reversion
[transaction_date] => 2014-10-30T00:00:00
[transaction_amount] => -1129794.96
[member_id] => 1
[type] => PensionsRolledBack
[transaction_type] => Pension
)
[24] => Array
(
[OriginEventId] => 0152c945-e15b-48f9-8a0e-e4b9eace4731
[Description] => Pension Reversion
[transaction_date] => 2014-10-30T00:00:00
[transaction_amount] => 1129794.96
[member_id] => 2
[type] => InternalTransfers
[transaction_type] => Accumulation
)
[36] => Array
(
[OriginEventId] => 0152c945-e15b-48f9-8a0e-e4b9eace4731
[Description] => Pension Reversion
[transaction_date] => 2014-10-30T00:00:00
[transaction_amount] => -1129794.96
[member_id] => 2
[type] => PensionCommencement
[transaction_type] => Accumulation
)
[56] => Array
(
[OriginEventId] => 0152c945-e15b-48f9-8a0e-e4b9eace4731
[Description] => Pension Reversion
[transaction_date] => 2014-10-30T00:00:00
[transaction_amount] => 1129794.96
[member_id] => 2
[type] => PensionCommencement
[transaction_type] => Pension
)
)
我的工作是删除任何抵消交易。例如:如果一个成员的积累具有正面和负面,则将其删除。
通过使用此结果数组,我需要根据member_id
,transaction_type
和transaction_amount
进行过滤。 (可能是正面的也可能是负面的)。
如果member_id
和transaction_type
相同,那么我需要删除抵消交易。
删除后,生成的数组必须如下所示:
Array
(
[23] => Array
(
[OriginEventId] => 0152c945-e15b-48f9-8a0e-e4b9eace4731
[Description] => Pension Reversion
[transaction_date] => 2014-10-30T00:00:00
[transaction_amount] => -1129794.96
[member_id] => 1
[type] => PensionsRolledBack
[transaction_type] => Pension
)
[56] => Array
(
[OriginEventId] => 0152c945-e15b-48f9-8a0e-e4b9eace4731
[Description] => Pension Reversion
[transaction_date] => 2014-10-30T00:00:00
[transaction_amount] => 1129794.96
[member_id] => 2
[type] => PensionCommencement
[transaction_type] => Pension
)
)