wepnop Posted March 2, 2011 Share Posted March 2, 2011 Hi, im having a problem using a global object in all my scripts and programs. Its a register singleton so it have all the configuration values, etc... Now im doing: 1-I create a script for testing, test.php 2-I include in that script 'errores.php', thats my error system library. 3-The error library include once 'registroglobal.php', thats my file for the global register. 4-Because i can use a lot of systems with a complete library or alone, i created a system where i test if the library module is part of a more greater library or not. If not, it instantiates the global register in errors.php (called in the include in test.php). 5-Here is the problem. Includes add and execute code, so, i must have all errors.php functions and the global register created. 6-If i test the global register in the test.php script, it goes well. 7-But if i call a function of my errores.php system, it says that my global register is undefined. Well, thats all the explanation. Whats going on? How can i solve this? Quote Link to comment https://forums.phpfreaks.com/topic/229361-global-variable-scope-and-duration/ Share on other sites More sharing options...
wepnop Posted March 2, 2011 Author Share Posted March 2, 2011 Sorry. Wrong forum! if a mod can changue to help code... Quote Link to comment https://forums.phpfreaks.com/topic/229361-global-variable-scope-and-duration/#findComment-1181777 Share on other sites More sharing options...
gizmola Posted March 2, 2011 Share Posted March 2, 2011 We really would need to see some code, and a specific example of where your problem is occurring. In particular we would need to see your registry class. Quote Link to comment https://forums.phpfreaks.com/topic/229361-global-variable-scope-and-duration/#findComment-1181778 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.