I think the code is obvious:
foreach ($programs as $program) {
    if ($program->name == 'foo') {
        unset($program);
    }
}
But it's not working!
 Isn't it possible to unset current property? Where's the problem? Is there any alternatives?
I think the code is obvious:
foreach ($programs as $program) {
    if ($program->name == 'foo') {
        unset($program);
    }
}
But it's not working!
 Isn't it possible to unset current property? Where's the problem? Is there any alternatives?
 
    
     
    
    foreach ($programs as $property => $program) {
//                    ^-----------^ added
    if ($program->name == 'foo') {
        unset($programs->$property);
//                     ^---------^ added
    }
}
