Check out array_filter () . Assuming you are running PHP 5.3+, this could do the trick:
$this->categories = array_filter($this->categories, function ($obj) { if (stripos($obj->title, 'webinar') !== false) { return false; } return true; });
For PHP 5.2:
function filterCategories($obj) { if (stripos($obj->title, 'webinar') !== false) { return false; } return true; } $this->categories = array_filter($this->categories, 'filterCategories');
source share