Re: Class returning more than one value
| From: | Richard Lynch | Date: | Mon, 16 Oct 2006 17:57:05 +0000 |
| Subject: | Re: Class returning more than one value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-243198@lists.php.net to get a copy of this message | ||
On Sat, October 14, 2006 5:06 am, Deckard wrote:
> How can i code a class with a function that returns more than one
> value ?
Classes do not return values.
Functions return values.
Class methods (which are very much like functions) return values.
In PHP, functions/methods do not return more than one value.
You must wrap your multiple values up into some kind of more complex
(non-scalar) structure.
An array or an instance of a class will both work fine.
Which one is appropriate depends on the existing application,
framework, and personal religious convictions of code develoment.
YMMV
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?