note 17149 deleted from function.include by jimw

From: Date: Mon, 17 Dec 2001 22:59:40 +0000
Subject: note 17149 deleted from function.include by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23058@lists.php.net to get a copy of this message
When using include files it is important to note that global variables do not fit into the scope of a included file...only the file that is calling the include will have access to global variables (primarily enviroment & system variables like $HTTP_REFERER)! I found it best to think of a include file as a completely separate php script. With it's own variable scope. TIP: You can pass your include files variables via the query string! BASIC EXAMPLE: $referer = explode("/",getenv("HTTP_REFERER")); include("includefile.inc?referer=".$referer[2]); ### INCLUDEFILE.INC CONTENTS BELOW ### if( $referer == "www.foo.com" ) print "Welcome foo!"; else return;

« previous php.notes (#23058) next »