Re: FUNCTIONS

From: Date: Wed, 21 May 2003 23:49:22 +0000
Subject: Re: FUNCTIONS
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148474@lists.php.net to get a copy of this message
On Wed, 2003-05-21 at 19:20, Dale wrote: > Hi, > Is there anyway to access variables outside of a function without explicitly > passing the variables in as arguments. > Just declare them as global within the function. e.g. <?php $var1 = 2; $var2 = 3; function add() { global $var1, $var2; $var1 = $var1 + var2; } add(); echo $var1; ?>

« previous php.general (#148474) next »