Hi,
On Fri, Jun 26, 2009 at 8:13 PM, Michael<[email protected]> wrote: > > We all know that we can make a static variable in to a global, but how do I > make a dynamic variable into a global? > > I am calling a function (b), from with a function (a) and I want function b to > have a dynamic value from function a IN THIS MANNER. > > Specifying that as a global in either or both functions a and b doesn't seem > to work. > Making them both global should work unless one of the functions is declared within another function, i.e. by using include inside a function. However, I generally abhor global, so there are 2 other ways to do this: - If this only happens in a() and b(), pass the "dynamic var" as a reference - if it happens a lot, use a singleton. HTH. Kind Regards, Jochen Daum Chief Automation Officer Automatem Ltd Phone: 09 630 3425 Mobile: 021 567 853 Email: [email protected] Skype: jochendaum Website: www.automatem.co.nz > Michael > > > > --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected] -~----------~----~----~----~------~----~------~--~---
