From: [EMAIL PROTECTED] Operating system: WinXP PHP version: 4.1.2 PHP Bug Type: Feature/Change Request Bug description: global required in functions
"In PHP global variables must be declared global inside a function if they are going to be used in that function." I really think PHP should not be different from C here - or at least there should be a setting for this. Even something like "global ALL;" would be better, but not ideal. The most common problem I run into by FAR is variables not being available in the local scope. Making me register 20 of them as global by name in every single function is counterproductive and goes against the idea of keeping code as simple as possible. Your justification for this is: "This can cause some problems in that people may inadvertently change a global variable." That is a very rare problem compared to the new problem this has introduced. JavaScript handles this better, requiring declaration with "var" to force a variable to be local only. I would much prefer this, and PHP doing it the way every other language does would also be preferable. -- Edit bug report at http://bugs.php.net/?id=16185&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16185&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16185&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16185&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16185&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16185&r=support Expected behavior: http://bugs.php.net/fix.php?id=16185&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16185&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16185&r=submittedtwice