Eli wrote: > Jochem Maas wrote: >> short of playing around with the global keyword >> (which won't work when you call includeIt() from >> another function)) your pretty much stuck. >> >> basically imho you need to rethink what it is your trying to do. >> >> function have their own scope for a reason; maybe consider using >> an array argument like so: >> >> function incIt($file, $args = array()) >> { >> extract((array)$args); >> include $file; // don't forget some error checking >> } >> >> function includeIt($file, $args = array()) >> { >> // bla >> incIt($file, $args); >> // more bla >> } >> >> I broke it down into 2 functions to avoid local variables >> being overridden in includeIt() [by the call to extract]. > > In addition to your solution, it is needed to transfer the variables by > reference. > > Your solution is good when you know what variables you want to transfer > ahead, and then make a list of them. But if I want to transfer all the > variables in the current environment scope? I can't see a way of doing that, especially if you want/need everything by reference. I can't help wondering what it is that your trying to do and why. maybe if you explained the exact problem your trying to solve the list could offer alternative solutions/strategies. as it stands I get the feeling your on the road to nowhere regarding this particular idea, php just doesn't offer the functionality you require. > > -thanks, Eli. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php