SOLVED: Global class instances mysteriously set to NULL

From: Date: Tue, 11 Jan 2005 07:51:56 +0000
Subject: SOLVED: Global class instances mysteriously set to NULL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-206058@lists.php.net to get a copy of this message
I *really* appreciate everybody's previous input. I may be a highly experienced programmer, but am relatively new to PHP. OK, I figured out what was going on. Google enough and read enough and the light goes on finally. The problem was not the "require_once" but a scoping problem. Specifically, I was calling "require_once" /from within a function/. Bad! Bad! Bad! The included source file was also including other files... thus the global class instance was just fine... it was simply hidden due to scoping rules. Yikes! I was really pulling my hair out when entire global functions were "disappearing" due to the screwed up scope. I finally figured out the problem in the "User Contributed Notes" section of the PHP manual (http://www.php.net/language.variables.scope). THANK YOU again...

« previous php.general (#206058) next »