setrawcookie

(PHP 5, PHP 7, PHP 8)

setrawcookieSend a cookie without urlencoding the cookie value

Description

setrawcookie(
    string $name,
    string $value = ?,
    int $expires_or_options = 0,
    string $path = ?,
    string $domain = ?,
    bool $secure = false,
    bool $httponly = false
): bool

Alternative signature available as of PHP 7.3.0 (not supported with named parameters):

setrawcookie(string $name, string $value = ?, array $options = []): bool

setrawcookie() is exactly the same as setcookie() except that the cookie value will not be automatically urlencoded when sent to the browser.

Parameters

For parameter information, see the setcookie() documentation.

Return Values

Returns true on success or false on failure.

Changelog

Version Description
7.3.0 An alternative signature supporting an options array has been added. This signature supports also setting of the SameSite cookie attribute.

See Also