Re: The default values of variables in a function

From: Date: Wed, 04 Oct 2000 10:02:31 +0000
Subject: Re: The default values of variables in a function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18556@lists.php.net to get a copy of this message
I think you are simply not allowed to use a variable as default, because php doesn't know which scope (global ? local ? class ?) the variable has in the function-head. Martin Matt wrote: > > I'm trying to set a default value for a variable in a php function. See > function below. > With the following, it gives me an error because I'm using a variable: > > function RunQuery($sql,$datasource=$app_mySQL_DSN) > > if I change it to this, it works: > > function RunQuery($sql,$datasource="theDSN") > > Any ideas as to my this is happening or if there is a work around? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#18556) next »