The variable `$listeners` of the foreach can be set by reference - and then `unset($listeners[$key]);`