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:

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.


Previous Comments:
------------------------------------------------------------------------

[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

------------------------------------------------------------------------

[2002-03-20 10:06:40] [EMAIL PROTECTED]

I agree with Rasmus (and I really like his story :-), but to help you
shoot yourself in the foot:

Declare and use your globals like this:
$g->id = 1000;
$g->username = "Marc";
// etc. until you have 20 of them

function fn() {
    global $g;
    $g->username = "Rasmus";
    }
with the added benefit of auto-global for any new global var you add in
a later stage of the project.

This looks very similar to using $GLOBALS["username"] inside your
function, which is what I use if I desperately _need_ a global.

Cheerio, Marc.

------------------------------------------------------------------------

[2002-03-20 09:58:22] [EMAIL PROTECTED]

This simply will not change.  It is a characteristic of the language. 
Perhaps you shouldn't be using 20 global variables?

See http://marc.theaimsgroup.com/?l=php-general&m=97984136422910&w=2

------------------------------------------------------------------------

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

Reply via email to