Answers for "php remove object from array by property"

PHP
0

php remove object from array by property

$new_array = [];
foreach ($myarray as $key => $value) {
    if ($value->catid == 29) {
        $new_array[] = $value;
        unset($myarray[$key]);        
    }
}
Posted by: Guest on May-20-2021

Code answers related to "php remove object from array by property"

Browse Popular Code Answers by Language