How to add a cookie?

Answers were Sorted based on User's Feedback



How to add a cookie?..

Answer / rupali

bool setcookie ( string $name [, string $value [, int
$expire [, string $path [, string $domain [, bool $secure
[, bool $httponly ]]]]]] )
for e.g.
<?php
$value = 'something from somewhere';

setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600); /* expire in
1 hour */
setcookie("TestCookie", $value, time()
+3600, "/~rasmus/", ".example.com", 1);
?>

Is This Answer Correct ?    7 Yes 0 No

How to add a cookie?..

Answer / lamp

How to add a cookie,means what exactly...plz explain

Is This Answer Correct ?    1 Yes 7 No

Post New Answer

More PHP Interview Questions

Tell me what is the difference between get and post?

0 Answers  


Is there an easy way to delete an element from a php array?

0 Answers  


How to compare two strings with comparison operators in php?

0 Answers  


Explain the difference b/w static and dynamic websites?

0 Answers  


What is the functionality of the function strstr and stristr?

2 Answers  






What is interface? Why it is used?

0 Answers  


Which is better get or post method?

0 Answers  


How do I expire a php session after 30 minutes?

0 Answers  


Is ruby on rails php?

0 Answers  


Here in this site i could not find the details for php ZEND certifications or i think u did not post any ? so i need the information about the php certification how to prepare and some of the mock exams?

1 Answers  


How does the identity operator === compare two values?

0 Answers  


Why constructor is not overridden?

0 Answers  


Categories