You probably defined the cookie in the php file that was in a different folder of your php file where you called your isset.
Thus, adding '/' as the default folder for a cookie makes it accessible to the entire website.
Sometimes you do not want this to happen because you may want to have two cookies with the same name, but different values โโdepending on which folder you are in.
Example: A website with 2 languages, you can have $_COOKIE['language'] = 'en'; in the folder /en/ and have $_COOKIE['language'] = 'fr'; in the /fr/ folder.
Therefore, when you set a cookie without specifying its directory, you must remember that it will be available only for files in the same folder or subfolders.
source share