note 86696 added to language.variables.scope

From: Date: Thu, 30 Oct 2008 08:13:08 +0000
Subject: note 86696 added to language.variables.scope
Groups: php.notes 
Request: Send a blank email to php-notes+get-145963@lists.php.net to get a copy of this message
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. ---- Server IP: 62.237.7.3 Probable Submitter: 193.34.40.30 ---- Manual Page -- http://www.php.net/manual/en/language.variables.scope.php Edit -- https://master.php.net/note/edit/86696 Del: integrated -- https://master.php.net/note/delete/86696/integrated Del: useless -- https://master.php.net/note/delete/86696/useless Del: bad code -- https://master.php.net/note/delete/86696/bad+code Del: spam -- https://master.php.net/note/delete/86696/spam Del: non-english -- https://master.php.net/note/delete/86696/non-english Del: in docs -- https://master.php.net/note/delete/86696/in+docs Del: other reasons-- https://master.php.net/note/delete/86696 Reject -- https://master.php.net/note/reject/86696 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145963) next »