Re: Returning TWO variables from function
| From: | Hugh Bothwell | Date: | Sat, 21 Jun 2003 14:46:06 +0000 |
| Subject: | Re: Returning TWO variables from function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152396@lists.php.net to get a copy of this message | ||
"Roy W" <php@wiegmann.net> wrote in message
news:000801c337e8$3443e130$1502a8c0@NEWHP...
> Can someone let me know how to return TWO variables from a function
>
> I tried:
>
> return $var1, $var2;
>
> But I get parse errors and other errors.
function ReturnMultiValues($a, $b, $c, $d) {
return array($a, $b, $c, $d);
}
list($first, $second, $third, $fourth) = ReturnMultiValues(1, 2, 3, 4);
--
Hugh Bothwell hugh_bothwell@hotmail.com Kingston ON Canada
v3.1 GCS/E/AT d- s+: a- C+++ L++>+++$ P+ E- W+++$ N++ K? w++ M PS+
PE++ Y+ PGP+ t-- 5++ !X R+ tv b++++ DI+++ D-(++) G+ e(++) h-- r- y+