What is the relationship between setcookie and $_COOKIE in PHP?
The relationship between setcookie and $_COOKIE in PHP is that setcookie is used to set a cookie in the user's browser, while $_COOKIE is used to retrieve the value of a cookie that has been previously set. When setting a cookie using setcookie, the value will be stored in the $_COOKIE superglobal array, which can then be accessed on subsequent page loads.
// Set a cookie with the name 'user' and value 'John'
setcookie('user', 'John', time() + 3600, '/');
// Retrieve the value of the 'user' cookie
$user = $_COOKIE['user'];
echo $user; // Output: John