Cookie per browser

setcookie("myCookie", 1, time()+1000 

myCookie is alive for 1000 seconds with the code above.

If I open the page with a browser , example, chrome,
The cookie will be alive for 1000 seconds.

If I reflesh or move to another page with the browser within 1000 seconds,
the cookie is still alive.

If I open the page with a new chrome within 1000 seconds,
the cookie is still alive.

I like to make it like the following.
If I reflesh or move to another page with the browser within 1000 seconds,
the cookie is still alive.
BUT,
If I open the page with a new chrome within 1000 seconds,
the cookie is NOT alive because it is not the same browser.

You can’t, and I really have no idea why you’d even want to do that. It is the same browser, regardless if you open a new tab or you detach the tab in a separate window. It’s the same parent process running, it’s the same configuration used, it is the same browser.
Adapt your logic, not the way browser works.

If both browsers are chrome then they ARE the same browser and so what you are trying to do cannot apply. The only way to force multiple copies of the browser to actually run rather than the same copy just opening multiple windows would be to run the browser inside a virtual machine where it cannot see if there is another copy running outside of that VM.

A simpler solution would be to actually use a different browser (eg Safari) and then since they are in fact different browsers they will not have access to the same session cookies.

Okay I see, Thank you.

Now I like to ask one more thing relating this issue.

If I reflesh or move to another page with the browser within 1000 seconds,
the cookie is still alive.

If I open the page with a new chrome within 1000 seconds,
the cookie is still alive.

If I shut down my computer and reboot it and open a new chrome browser
within 1000 seconds,
the cookie is still alive.

I like to make it like the following.

If I reflesh or move to another page with the browser within 1000 seconds,
the cookie is still alive.
If I open the page with a new chrome within 1000 seconds,
the cookie is still alive.
BUT,
If I shut down my computer and reboot it and open a new chrome browser
within 1000 seconds,
the cookie is NOT alive.

You have a choice.

You can either have the cookie last 1000 seconds for that browser regardless of how many times the browser is opened and closed during that time

OR

You can have the cookie last for as long as the browser stays open and have it deleted when the browser is closed.

To get the second of these simply remove the expiry time from the command writiing the cookie. It will then be retained in the browser itself rather than being saved and so will disappear as soon as the browser is closed.

You could then save the time in the cookie data itself and compare the current time to the time in the cookie to see if the 1000 seconds has passed instead of simply checking if the cookie exists.

I feel that your suggestion looks very cool.

As your say, the code below which is removed the expiry time works fine.

setcookie("myCookie", 1)

I used the code below before I simply remove the expiry time. the red part below is for working the cookie with sub-domains.

setcookie("myCookie", 1 ,time()+100, [COLOR="Red"]"/", ".dot.kr"[/COLOR]);

Now I simply remove the expiry time like the code below, but it doesn’t work saying Warning: setcookie() expects parameter 3 to be long, string given in \cookie11-2.php on line 2

setcookie("myCookie", 1 , [COLOR="Red"]"/", ".dot.kr"[/COLOR]);

How can I remove the warning and make it to work?

You check www.php.net/setcookie to check which parameters are expected, then you see that you passed completely wrong parameters to your setcookie() and then you fix it.
Documentation is available, and it’s not gibberish so it’s easy to understand even to novices.

setcookie("myCookie", "your value", 0, "/", ".dot.kr");