I have an array which consists of this set of items
array(3) {
[0]=>
array(4) {
["Field1"]=>
string(8) "80000007"
["Field2"]=>
string(16) "O70000006"
["Field3"]=>
string(0) ""
["Field4"]=>12345
string(0) ""
}
[1]=>
array(4) {
["Field1"]=>
string(8) "80000008"
["Field2"]=>
string(16) "O70000007"
["Field3"]=>
string(0) ""
["Field4"]=>78965
string(0) ""
}
[2]=>
array(4) {
["Field1"]=>
string(8) "80000009"
["Field2"]=>
string(16) "H80000006"
["Field3"]=>
string(0) ""
["Field4"]=>12345
string(0) ""
}
}
Now my question is Iam trying to display only the items once from array or trying to filter the array in such a way if the "Field2" has a value starting with "O" or "H" and their "Field4 " value should be different . If the "Field4" value is same for the each of the row then we dont display that row or array item . For eaxample from the above array we will get 2 items as follows
1)80000007 O70000006 12345
2)80000008 O70000007 78965//we are not displaying the 3rd Item because The "Field4 " is same . we display only once
foreach ($resultset as $key => $value){
echo $key."<br>"; /// outputs 0,1,2
echo $value['Field2']."<br>"; // outputs O70000006, O70000007, H80000006
}