i got arrays that needs to be unique and i need to have a condition to check if value dis is in ANSWERED status , if yes then keep it and remove the one that is in NO ANSWER status
this is my full array
Array
(
[0] => Array
(
[dest] => 960
[dis] => ANSWERED
)
[1] => Array
(
[dest] => 596
[dis] => NO ANSWER
)
[2] => Array
(
[dest] => 596
[dis] => ANSWERED
)
[3] => Array
(
[dest] => 595
[dis] => NO ANSWER
)
[4] => Array
(
[dest] => 595
[dis] => NO ANSWER
)
)
after removing duplicates :
Array
(
[dest] => 960
[dis] => ANSWERED
)
Array
(
[dest] => 596
[dis] => NO ANSWER
)
Array
(
[dest] => 596
[dis] => ANSWERED
)
Array
(
[dest] => 595
[dis] => NO ANSWER
)
with this code :
foreach(array_unique($testArr, SORT_REGULAR) as $doc)
{
print_r($doc);
}
what i need to do now is remove array[1] that is NO ANSWER because array[2] with key : dis is ANSWERED
thanks for any help