Search in a multi-dimensional array with multiple values

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 ) ) 
0
arrays php
Nov 29 '16 at 7:27
source share

No one has answered this question yet.

See similar questions:

61
Search for multidimensional PHP arrays (search by a specific value)
8
PHP array search for multiple key / value pairs

or similar:

2893
Loop through an array in JavaScript
2466
Sort an array of objects by the value of the string property
2171
How to determine if an array contains a specific value in Java?
1618
Copy array by value
1342
Scroll array of strings in Bash?
1167
Determine if an array contains a value
1165
Check if value exists in array in Ruby
1071
How to create a two-dimensional array in JavaScript?
995
How to sort a multidimensional array by value?
-one
Search in a multi-dimensional array with multiple values



All Articles