PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mattalexx
Forum Newbie
Posts: 2 Joined: Sun May 25, 2008 4:25 pm
Post
by mattalexx » Sun May 25, 2008 4:28 pm
Can anyone explain why this variable is registering in the $GLOBALS array? Register globals is off on the server.
Code: Select all
$foo = new stdClass();
var_dump($GLOBALS['foo']);
print ini_get("register_globals");
// Outputs:
// object(stdClass)#5 (0) {
// }
// Off
hansford
Forum Commoner
Posts: 91 Joined: Mon May 26, 2008 12:38 am
Post
by hansford » Mon May 26, 2008 2:14 am
It displays when I run it on my server running php 5 as well with globals turned off. Maybe its because stdClass is the base class for php.
mattalexx
Forum Newbie
Posts: 2 Joined: Sun May 25, 2008 4:25 pm
Post
by mattalexx » Mon May 26, 2008 3:22 pm
I don't think that's the reason. I replaced my own class name for stdClass for the sake of this example..
Code: Select all
class foobar {}
$foobar = new foobar;
var_dump($GLOBALS['foobar']);
var_dump(ini_get("register_globals"));
// object(foobar)#1 (0) {
// }
// string(0) ""