I have an array. After doing some condition my resulting array is as shown below.
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
)
)
My job is to remove any offsetting transactions. For example: If one member's accumulation has a positive and negative, then remove them.
By using this resultant array, I need to filter based on member_id
, transaction_type
and transaction_amount
. (it may be positive or negative).
If member_id
and transaction_type
are same then I need to remove the offsetting transaction.
After removal, the resulting array must look like this:
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
)
)