Just a little help with explaining
Posted 22 April 2006 - 07:24 AM
$VAR = "";
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.
Posted 22 April 2006 - 02:41 PM
that single line of code does not expain everything but here goes:
$VAR 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.
Posted 22 April 2006 - 05:07 PM
Couldn't find it at php.net
Posted 22 April 2006 - 05:40 PM
In order to understand where $VAR 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.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users