Page 1 of 1

GLOBAL vars

Posted: Wed Mar 22, 2006 4:13 pm
by shiznatix
I want to set some global variables in the header file in the $_GLOBAL array then be able to use them in a class. heres what i am doing:

header.php

Code: Select all

$_GLOBAL['sroot'] = 'somthing';
someclass.php

Code: Select all

require_once 'header.php';

class some
{
    function some()
    {
        echo $_GLOBAL['sroot'];
    }
}
but of course I get the undefined variable. how do I work this situation?

Posted: Wed Mar 22, 2006 4:18 pm
by feyd

Posted: Wed Mar 22, 2006 4:26 pm
by shiznatix
ahhhhh thanks ok got it