note 61389 added to language.variables.scope

From: Date: Thu, 02 Feb 2006 05:32:46 +0000
Subject: note 61389 added to language.variables.scope
Groups: php.notes 
Request: Send a blank email to php-notes+get-102857@lists.php.net to get a copy of this message
Daft Truly Daft PHP is frustrating, you seemed to spend 1/2 your time working around "unusual" design decisions such as having to declare globals as global before you can access them. this causes problems. For instance. if while inside a function or class scope you are required to call a third party script using include('3rdparty.php'). That third party script then defines 'global' variables Now a function within that 3rd party script wants to access those variables, so it does the right thing and predeclares the variable with 'global' ie: global $globalvar; But guess what, because the script was included inside your class those so called global variables are not actually global variables any more and the function fails. any ideas on a fix? my attempts have only produced redeclaration errors. If there is a way around this it NEEDS to be documented By the way most of these issues have been solved in other languages. why does PHP repeat the errors of history? ---- Server IP: 203.16.234.91 Probable Submitter: 61.68.220.51 ---- Manual Page -- http://www.php.net/manual/en/language.variables.scope.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61389 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61389&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61389&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61389&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61389&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61389&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61389&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61389&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61389&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102857) next »