remove entire stdclass object based if condition php
i have an stdObject
Array
(
[0] => stdClass Object
(
[id] => 66159
[test_ids] => 32489,32490
[special_test_ids] => 33290,47516,56835,68201,68230
[total_test] => 7
[entry_done] => 1
[approval_done] => 1
)
[1] => stdClass Object
(
[id] => 66160
[test_ids] => 32489,32490
[special_test_ids] => 33290,47516,56835
[total_test] => 5
[entry_done] => 5
[approval_done] => 5
)
)
i am trying to unset whole key where condition met
here is my code so far
$newArray = array();
foreach ($result_array as $key => $value) {
if ($value->entry_done == $value->total_test) {
$value->unset($key);
}
$result[]=$value;
}
Expected Result =
$NewArray
(
[0] => stdClass Object
(
[id] => 66159
[test_ids] => 32489,32490
[special_test_ids] => 33290,47516,56835,68201,68230
[total_test] => 7
[entry_done] => 1
[approval_done] => 1
)
)
when i am executing i am getting an php error please correct me where i am doing wrong thanks