note 93186 added to language.variables.scope

From: Date: Thu, 27 Aug 2009 16:58:16 +0000
Subject: note 93186 added to language.variables.scope
Groups: php.notes 
Request: Send a blank email to php-notes+get-159940@lists.php.net to get a copy of this message
While writing php code that was served as a "view" from within a cms (in my case ezpublish), the "global" keyword seemed to have stopped working in php5. example #1 on this page simply returned "2", not "3". However, the error was somewhere else. Since my php code was included within other code by the CMS, the first assignments (a=1,b=2) were apparently not really in the global scope, and hence could not be referenced by the keyword "global" in php5. This worked in php4. In my particular case, prepending <code> global $a,$b; </code> to the code (which is invalid php in a root context afaik) fixed it. $2c, *-pike ---- Server IP: 91.199.167.18 Probable Submitter: 92.254.50.195 ---- Manual Page -- http://www.php.net/manual/en/language.variables.scope.php Edit -- https://master.php.net/note/edit/93186 Del: integrated -- https://master.php.net/note/delete/93186/integrated Del: useless -- https://master.php.net/note/delete/93186/useless Del: bad code -- https://master.php.net/note/delete/93186/bad+code Del: spam -- https://master.php.net/note/delete/93186/spam Del: non-english -- https://master.php.net/note/delete/93186/non-english Del: in docs -- https://master.php.net/note/delete/93186/in+docs Del: other reasons-- https://master.php.net/note/delete/93186 Reject -- https://master.php.net/note/reject/93186 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159940) next »