pneudralics Posted April 22, 2006 Share Posted April 22, 2006 // MEMBERS COOKIE$VAR[4] = "";can someone explain how var4 works? what does it do when it writes to the cookie?Is $VAR global or the coder have to set what the value is?Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/8105-just-a-little-help-with-explaining/ Share on other sites More sharing options...
eves Posted April 22, 2006 Share Posted April 22, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/8105-just-a-little-help-with-explaining/#findComment-29589 Share on other sites More sharing options...
pneudralics Posted April 22, 2006 Author Share Posted April 22, 2006 Where does it list the globals for VAR[number]?Couldn't find it at php.netThanks. Quote Link to comment https://forums.phpfreaks.com/topic/8105-just-a-little-help-with-explaining/#findComment-29621 Share on other sites More sharing options...
wildteen88 Posted April 22, 2006 Share Posted April 22, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/8105-just-a-little-help-with-explaining/#findComment-29629 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.