Re: Question on functions

From: Date: Wed, 10 Nov 2004 17:10:37 +0000
Subject: Re: Question on functions
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-201702@lists.php.net to get a copy of this message
Yeah the global stuff I understand and can use fine. What I would like more information about is the use of arguments to functions i.e. function( $user, $pass, $db ) { $db = @mysql_connect( $user, $pass, $db ); } I understand parts but googling for the proper use of functions in php hasn't gotten me anywhere... Sebastian Mendel wrote:
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;
}
-- Jason Gerfen Student Computing Marriott Library 801.585.9810 jason.gerfen@scl.utah.edu "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show

« previous php.general (#201702) next »