Not all cookie saved from one page

I have a long text that needs to be saved in cookies. I break it down by the number of characters and try to save it into cookies cyclically, but only the last one is saved. Below is an example of code that should do this.

To save cookies:

function generateRandomString($length = 10) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[random_int(0, $charactersLength - 1)];
    }
    return $randomString;
}

$token = generateRandomString(8851);
$name = 'ck';
$exp = 3600;
$domain = '.example.local';

if(strlen($token) > 4096) {
    $values = str_split($token, 4095);
    foreach ($values as $key => $value) {
        setcookie(
            name: $name . '_' . $key,
            value: $value,
            expires_or_options: time() + $exp,
            domain: $domain
        );
    }
} else {
    setcookie(
        name: $name,
        value: $token,
        expires_or_options: time() + $exp,
        domain: $domain
    );
}

For view cookies:

<?php
echo '<pre>';
var_dump($_COOKIE);