Re: Passing Variables from One Function to Another

From: Date: Wed, 11 Jul 2001 18:17:10 +0000
Subject: Re: Passing Variables from One Function to Another
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-8262@lists.php.net to get a copy of this message
You'd need the second function to accept and argument. That way you can do: function boo() { $foo = 3; return $foo; } function ahh($foo) { $fum = $foo + $fi; } $test = boo(); ahh($test); Or you could declare $foo as a global variable, but I tend not to do it that way. -- phill > Hey All, > > I'm feeling pretty dumb right now. Is there a way to pass a variable from > one function to another. So for instance, if I have one function that > returns x such as > > function boo() { > > $foo = 3; > return $foo; > > } > > And then I have another function and I want to use $foo. > > function ahh() { > > $foo; > $fum = $foo + $fi; > > } > > I'm missing something but any help would be nice. Thanks. > > -Flint >

« previous php.windows (#8262) next »