Jump to content

Recommended Posts

Hi,

that single line of code does not expain everything but here goes:

$VAR[4] is an array, and on it just takes any values you assign to it. I'm guessing that the line is just for initialization of a config or something. Writing to the cookie does not happen here but on some other line, it just sets the value to the array and write its content later on to the cookie, try searching for "setcookie(", its the actual function that writes the contents of the variable to the cookie.

Your other question, if is $VAR a global variable, depends on where you find that line, if it is outside any function or class, it is a global variable, and also, if your PHP ini's global variable is set to YES, then its definitely global.

hope that helps.
PHP doesnt have a global variable called $VAR. $VAR is set in your script somewhere which might holds a users name in $VAR[4] and then sets a cookie which stores the username of the user.

In order to understand where $VAR[4] is set or how it is being created I (or we) cant really tell you how $VAR is set or what it is doing. You wont be able to find $VAR anywhere at php.net as its not a predifined (global) variable.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.