Answer the question
In order to leave comments, you need to log in
How to make a mutable cookie name?
You need to make a variable cookie name so that a unit is added to the cookie name, here is a code that shows the site visit counter, but you need to make the cookie name also change, how to do it?
setcookie("test", cook());
setcookie("test", cook());
echo "Счётчик посещений сайта {$_COOKIE["test"]}";
function cook(){
if (isset($_COOKIE["test"])) {
$_COOKIE["test"]++;
}else{
$_COOKIE["test"] = 1;
}
return $_COOKIE["test"];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question