private function removeStreamById($stream_id, &$pool) { foreach ($pool as $index => $stream) { if ((int) $stream == $stream_id) { @fclose($stream); unset($pool[$index]); return; } } }