php remove object from array by property

Solutions on MaxInterview for php remove object from array by property by the best coders in the world

showing results for - "php remove object from array by property"
Lucas
05 May 2017
1$new_array = [];
2foreach ($myarray as $key => $value) {
3    if ($value->catid == 29) {
4        $new_array[] = $value;
5        unset($myarray[$key]);        
6    }
7}
8