setcookie ('hoge', '', time ()-1800);
Answer # 1
I think the desired behavior is possible, but I don't understand the merit of it.
I think it's more convenient to control the addition/deletion of cookies on the other hand, but it's convenient, but is there a clear merit of using JS/PHP together?
I think that adding/deleting cookies in PHP eliminates the risk of JS being disabled and not being executed.
Answer # 2
The requirement is difficult to read, but if you use the same browser, cookies should be shared.
Try it out and see the changes from your browser development tools.
- php exception handling (i want to catch run-time errors like vb on error)
- regarding and post processing in php
- reading and writing php data
- how to use php and function
- php - image handling when introducing the markdown editor
- php - combined use of $_post  and for statement
- uncertainties related to exception handling in php
- PHP shielding errors and tips
- handling of $i in php for statement
- vuejs and php integration
- php - i get an error in endif and i don't know how to fix it
- php - wordpress database and post type
- php - [ruby] == and&&
- php - please let us know your opinion on the handling of common data in the site design
- php - regarding error handling when stripe settlement fails
- php - how to use for and while
- how to handle error handling of cakephp3 middleware
- box click and text display in php
- php - laravel migration error handling
- php - how to display select boxes in conjunction
- php - about the outline of the implementation of the like function
- php - the menu does not close when you press the in-page link in the hamburger menu on wordpress
- php - wordpress operation in intellij idea
- php - how to implement preview dialing, click call installation, recording, etc