Re: Question on functions

From: Date: Wed, 10 Nov 2004 16:45:35 +0000
Subject: Re: Question on functions
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-201697@lists.php.net to get a copy of this message
Jason wrote:
Could you give me a good example of the tip you recommend or point me to a good tutorial on it?
$GLOBALS holds all variables defined in main(), main() meaning outside any function or class //main() $my_var = 'test'; function myFunction() {
    echo $GLOBALS['my_var'];
    // is the same as:
    global $my_var
    echo $my_var;
    // 'global' just creates a local reference to the global variable
    // global $my_var; is the same as:
    $my_var =& $GLOBALS['my_var'];
    echo $my_var;
} -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetime www.sf.net/projects/phptimesheet

« previous php.general (#201697) next »