yii\web\CookieCollection::remove PHP Method

remove() public method

If $removeFromBrowser is true, the cookie will be removed from the browser. In this case, a cookie with outdated expiry will be added to the collection.
public remove ( Cookie | string $cookie, boolean $removeFromBrowser = true )
$cookie Cookie | string the cookie object or the name of the cookie to be removed.
$removeFromBrowser boolean whether to remove the cookie from browser
    public function remove($cookie, $removeFromBrowser = true)
    {
        if ($this->readOnly) {
            throw new InvalidCallException('The cookie collection is read only.');
        }
        if ($cookie instanceof Cookie) {
            $cookie->expire = 1;
            $cookie->value = '';
        } else {
            $cookie = new Cookie(['name' => $cookie, 'expire' => 1]);
        }
        if ($removeFromBrowser) {
            $this->_cookies[$cookie->name] = $cookie;
        } else {
            unset($this->_cookies[$cookie->name]);
        }
    }