Inside a function you normally reach global varialbes by writing 'global $myvar;' Is it possible to declare $myvar in such a way that I can reach it from within any function without global'ing it?
Have you tried to use static $myvar instead of global $myvar?