php remove object from array by property

156

php remove object from array by property -

$new_array = [];
foreach ($myarray as $key => $value) {
    if ($value->catid == 29) {
        $new_array[] = $value;
        unset($myarray[$key]);        
    }
}

Comments

Submit
0 Comments