Re: More than one values returned?

From: Date: Tue, 19 Feb 2008 02:06:34 +0000
Subject: Re: More than one values returned?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-269580@lists.php.net to get a copy of this message
C.R.Vegelin wrote: > <?php > $in = 4; > calcpows($in, $pow2, $pow4); > echo "in = $in pow2=$pow2 pow4=$pow4"; > > // define return fields as &$... > function calcpows($in, &$pow2, &$pow4) > { > $pow2 = $in * $in; > $pow4 = $pow2 * $pow2; > } > ?> > > HTH > Thats a good example, and a good reason for passing values by Reference instead of by Value. I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. -- ================== Nick Stinemates (nick@stinemates.org) http://nick.stinemates.org AIM: Nick Stinemates MSN: nickstinemates@hotmail.com Yahoo: nickstinemates@yahoo.com ==================

« previous php.general (#269580) next »