In PHP, how can a function body reference variables in its dynamic parent?
In PHP, how can a function body reference variables in its dynamic parent? In PHP, one can write $a="$b$c"; This concatenates the assumed strings in $b and $c into $a elegantly (that is, using minimal yet clear syntax). Now I want to move this statement into a function. The problem is that $b and $c are naturally interpreted as being local to this function, not its caller (which can be the global code or a function). Even if the caller defines $b and $c, this new function cannot see those definitions. I want to do something clever that requires the statement to work the same (except for the location of $a) even though it has been moved into a function. Furthermore, I want this to be efficient. No use of extract() or debug_backtrace(). Just want to use the caller's local scope. I don't mind if I use Zend to get the caller's symbol table, or any other hack, so long as it's efficient. Don't worry, I'm not going to use this as general programming practice ...