Home >> PHP >> $_COOKIE super global variable in PHP

$_COOKIE super global variable in PHP

Cookie is a small file that stored on the client computer. A cookie is used to identify a user.

Syntax

setcookie(name, value, expire, path, domain, secure, httponly);

Example

setcookie("user","ram",time()+60*60*24);// create cookie

echo $_COOKIE['user'];//access cookie

setcookie("user","ram",time()-60*60*24);//destroy cookie

Output

ram

Post Your Comment

Next Questions
$_SESSION super global variable
Ternary operator
Variable types
What is password encrypt and decrypt function
Difference between echo and print
How can destroy and unset the variable of a session
Function
isset() function
unset() function
empty() function
What are function for controlling script execution
exit() function
die() function
fun_num_args() function
ereg_replace() function
ereg_ireplace() function
preg_match() function
preg_replace() function
File handling
fopen() function
fclose() function
fread() function
create the file
Check the file is available or not
Destroy the file

Copyright ©2022 coderraj.com. All Rights Reserved.