Re: Returning multiple values from function

From: Date: Thu, 12 Dec 2002 09:39:24 +0000
Subject: Re: Returning multiple values from function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127970@lists.php.net to get a copy of this message
you can always return an array of arrays ... return array($array1, $array2, ...); but in your case why not make the column names the array keys so the one array holds both column names and types. Tim Ward http://www.chessish.com mailto:timward@chessish.com ----- Original Message ----- From: Lisi <lists@shemeshdirectory.co.il> To: <php-general@lists.php.net> Sent: Thursday, December 12, 2002 9:34 AM Subject: [PHP] Returning multiple values from function > Is it possible to return multiple values from a function? > > I have a function that queries a MySQL database for column names (SHOW > COLUMNS) and then I go through the values return and create two arrays - > one containing column names and one containing column types. > > Is it possible to return two arrays, or do I have to combine them somehow > and then separate afterwards? Is there another way to do this? > > The code works fine when used regularly but I need to put it into a > function so I can reuse it in more than one page. > > Thanks, > > -Lisi > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#127970) next »