Basic PHP Programming Question:
Download Questions PDF

How to set cookies in PHP?

Answer:

setcookie('variable','value','time')
;
variable - name of the cookie variable
value - value of the cookie variable
time - expiry time
Example: setcookie('Test',$i,time()+3600);

Test - cookie variable name
$i - value of the variable 'Test'
time()+3600 - denotes that the cookie will expire after an one hour

Download PHP Interview Questions And Answers PDF

Previous QuestionNext Question
How can we increase the execution time of a php script?How to reset/destroy a cookie in PHP?