top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Explain setcookie() function in PHP?

+1 vote
497 views
Explain setcookie() function in PHP?
posted Dec 14, 2017 by Jdk

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

The setcookie() function defines a cookie to be sent along with the rest of the HTTP headers.
A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer.With PHP, you can both create and retrieve cookie values.
The name of the cookie is automatically assigned to a variable of the same name. For example, if a cookie was sent with the name "user", a variable is automatically created called $user, containing the cookie value.
Example:

$title= "Query Home!";

// cookie will expire when the browser close
setcookie("myCookie", $title)

;

answer Dec 27, 2017 by Madhavi Latha
0 votes

Hello ,

The setcookie() function is used to set cookie for any user. It is helpful to user when he/she will back to same website second time.
A cookie is small file which is stored in browser.

in php we can use cookie like this:

$Name = "Hello welcome!";

setcookie("myCookie", $Name);
answer Aug 23, 2019 by Siddhi Patel
Similar Questions
0 votes

If I am using an editor such as Eclipse to analyze a large PHP system and I want to find the file that a function is declared in then I can search for it. I think that the (right-click) context menu for the function sometimes has an item to open the declaration but that does not always work. The same for an include statement; even if I don't know what the path will be during execution and even if the source is in multiple folders, I can search for the file. For large systems however all that can take time (my time).

Is there a tool that can process thousands (at least a couple thousand) files and produce data of what file that a called function exists in and where a function is called from? In other words, caller/called data. I understand the technical challenges. In PHP includes are processed during execution so I know it might not be possible but I am asking if there is anything that can do it as much as possible.

...