note 86696 deleted from language.variables.scope by danbrown

From: Date: Thu, 30 Oct 2008 14:20:02 +0000
Subject: note 86696 deleted from language.variables.scope by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145967@lists.php.net to get a copy of this message
Note Submitter: petersjazz at telia dot com ---- On this page its just mentioned that is happening in one source file (or directly called source file). The scoping between different sites is also interesting and something I had totally misunderstod. I thought that require_once meant once per session but that not the case. And the use of session_start() is also a bit unclear to me. My code looked like this: [index.php] require_once('include.php'); ... put some value in object $xy link to somepage.php ... [somepage.php] require_once('include.php'); // should normally not be called I thought use object $xy ... [include.php] require('objectx.php'); session_start(); $config['id']=123434; $xy=new Objectx(); connect to db etc ... Now I suddenly found out that $xy is not a global between index.php and somepage.php and include.php is called again in somepage.php.

« previous php.notes (#145967) next »