Globals and Valid Use...
Posted 06 March 2006 - 05:11 PM
The question is purely academic at this point...but I have a question about the valid use of a global variable and whether the following would work or error out:
$x = 1;
function myFunction($y = $x)
Posted 06 March 2006 - 05:18 PM
If that makes any sense
I'm sure someone else can add some more to my try at answering your question.
Posted 06 March 2006 - 05:22 PM
...because the global hasn't been declared within the function yet...and is operating as the default value of information passed into the variable...
...additional...slightly related question...let's say I have:
function myFunction($y = $x, $b = "string", $n = 1)
...and I want to call the function with somethin' like a myFunction("string")...where it will only change the default value of $b...leaving $y and $n alone...
...basically...is there a way to explicitly address to which value a function call sends its arguments?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users