Is there a way to call a function so the function shares the scope of the
caller?
For example, I was playing around with making a php version of the cold
fusion tag CFPARAM
What that cold fusion tag/sorta-function does is:
1) Check if a variable exists
2) If it doesn't, creat it with a default value
I could do it inline like this:
eval("if(empty( \$testVar)) \testVar=null;" );
but I don't see how I could do it as a function, like say
phParam("test")
.... is there any way for php to see all variables in the caller's scope
without passing them in or declaring them all global?
caller?
For example, I was playing around with making a php version of the cold
fusion tag CFPARAM
What that cold fusion tag/sorta-function does is:
1) Check if a variable exists
2) If it doesn't, creat it with a default value
I could do it inline like this:
eval("if(empty( \$testVar)) \testVar=null;" );
but I don't see how I could do it as a function, like say
phParam("test")
.... is there any way for php to see all variables in the caller's scope
without passing them in or declaring them all global?
Comment