Thnaks. It solved my problem. sanjay
----- Original Message ----- From: "Jason Wong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 29, 2002 7:50 PM Subject: Re: [PHP] return multiple value from function On Monday 29 April 2002 22:11, sanjay wrote: > Hi List, > > I am new to php programming and wanted to know if it is possible to return > multiple value from a function like cgi programs. > How can I get the following result using php. > > ($var1, $var2) = myfunction($a,$b); > > > function myfunction($c,$d) > { > // code > // code > return ($e,$f); > } No. But it is possible to get similar results. a) Return an array $result = myfunction($a, $b); echo $result['e']; echo $result['f']; function myfunction($c, $d) { do something $result['e'] = $this_is_e; $result['f'] = $this_is_f; return $result; } b) Use references myfunction($c, $d, $e, $f); echo $e; echo $f; function myfunction($c, $d, &$e, &$f) { do something $e = $this_is_e; $f = $this_is_f; } -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "I didn't know it was impossible when I did it." */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php