Hi, I have a few functions that work together. Within each one, various variables are created. How can I access variables created in function A from with in function B? Is there some declaration that makes the variables from all the functions available to all the functions without changing the PHP global setting? Thanks!
If you need something from Function A then you should return it. If you need more than one variable from Funtion A then you should return an array. function A() { return 1; } function B() { $a = A(); } Code (markup): Globals are a great way to make your program unmanagable.
Just create a php file called global_functions.php, and include this file in your header (or just make sure it's include globally). Then you can put however many "globally accessible" but still not global variables and functions sitewide