I have an array. After fulfilling some condition, my resulting array will be 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 delete any netting transactions. For example: if one member accumulation has positive and negative, then delete them.
Using this resulting array, I need to filter based on member_id , transaction_type and transaction_amount . (this can be positive or negative). If member_id and transaction_type match, then I need to delete the netting transaction.
After removal, the resulting array should 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 ) )
arrays php
user7205570 Nov 29 '16 at 7:27 2016-11-29 07:27
source share