Re: function return

From: Date: Tue, 28 May 2002 18:39:13 +0000
Subject: Re: function return
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-99533@lists.php.net to get a copy of this message
On Tue, 28 May 2002, W. Enserink wrote: > I have a Q about functions. My function should return 2 values. What > syntax should I use and how do I call these values outside the function? > Are these values returned as en array or something? > > > this is what I have now, > ----------------------------- > function myFunction($some_vars) > { > $max=count($some_vars); > $some_value=($max/2); > return($some_value && $max); > } function myFunction ($some_vars) { $max = count($some_vars); $some_value = ($max / 2); return array($some_value, $max); } list($x, $y) = myFunction($_SERVER); echo "returned $x and $y"; miguel

« previous php.general (#99533) next »