ID: 16185 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Feature/Change Request Operating System: WinXP PHP Version: 4.1.2 New Comment:
ok, try this then: foreach($GLOBALS as $key => $value) if($key != "GLOBALS") global $$key; Previous Comments: ------------------------------------------------------------------------ [2002-03-21 10:56:47] [EMAIL PROTECTED] Interestingly, the one-line solution for accessing globals seems to be causing PHP.exe to hang. I have narrowed it down to the following code which makes php die under WinXP (at least it does here) <? session_start(); session_register("Ses"); $Ses->UserAdvanced = true; function test() { foreach($GLOBALS as $key => $value) global $$key; // get access to all globals } test(); ?> ------------------------------------------------------------------------ [2002-03-20 18:18:19] [EMAIL PROTECTED] Thanks for the suggestions, I think I will stick all my globals in a structure since this won't be changed. I agree that globals are not good in an object oriented language, but I still disagree about this - I would venture to guess that PHP is used mostly for small scale scripting, and the needs of the many - smallness and simplicity - outweigh the needs of the few poor saps who are trying to write an OS with it. ------------------------------------------------------------------------ [2002-03-20 10:44:42] [EMAIL PROTECTED] bogusified ------------------------------------------------------------------------ [2002-03-20 10:44:04] [EMAIL PROTECTED] #1 don't use globals. period. we are *not* going to change the language to support bad design techniques #2 you can get all global symbols by doing foreach($GLOBALS as $key => $value) global $$key; ------------------------------------------------------------------------ [2002-03-20 10:07:18] [EMAIL PROTECTED] Changing this would break waaay to much, and it's against the nature of PHP. i think it's a bad idea to change this. Derick ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/16185 -- Edit this bug report at http://bugs.php.net/?id=16185&edit=1