Re: [PHP] More than one values returned?

2008-02-26 Thread tedd
At 1:08 PM -0500 2/25/08, Daniel Brown wrote: On Sat, Feb 23, 2008 at 6:21 AM, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2008-02-22 at 18:13 -0500, tedd wrote: He said your narratives, not your jokes. ;) Besides, if you gave up programming and took up comedy, both

Re: [PHP] More than one values returned?

2008-02-26 Thread Robert Cummings
On Tue, 2008-02-26 at 10:32 -0500, tedd wrote: At 1:08 PM -0500 2/25/08, Daniel Brown wrote: On Sat, Feb 23, 2008 at 6:21 AM, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2008-02-22 at 18:13 -0500, tedd wrote: He said your narratives, not your jokes. ;) Besides, if you

Re: [PHP] More than one values returned?

2008-02-26 Thread Daniel Brown
On Tue, Feb 26, 2008 at 10:40 AM, Robert Cummings [EMAIL PROTECTED] wrote: This reminds me of when I commented to a friend that I swim everyday but still can't seem to lose the weight I want. He replied Look at whales, they swim all the time and don't lose weight. I understood his

RE: [PHP] More than one values returned?

2008-02-26 Thread Bastien Koert
From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: php-general@lists.php.net Date: Tue, 26 Feb 2008 10:40:34 -0500 Subject: Re: [PHP] More than one values returned? On Tue, 2008-02-26 at 10:32 -0500, tedd wrote: At 1:08 PM -0500 2/25/08, Daniel Brown wrote: On Sat, Feb 23, 2008 at 6

Re: [PHP] More than one values returned?

2008-02-25 Thread Daniel Brown
On Sat, Feb 23, 2008 at 6:21 AM, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2008-02-22 at 18:13 -0500, tedd wrote: At 5:27 PM -0500 2/22/08, Robert Cummings wrote: On Fri, 2008-02-22 at 17:04 -0500, Nathan Nobbe wrote: and btw; your narratives are are just damned hilarious rob

Re: [PHP] More than one values returned?

2008-02-23 Thread Robert Cummings
On Fri, 2008-02-22 at 18:13 -0500, tedd wrote: At 5:27 PM -0500 2/22/08, Robert Cummings wrote: On Fri, 2008-02-22 at 17:04 -0500, Nathan Nobbe wrote: and btw; your narratives are are just damned hilarious rob ;) Take that Ted... I'm quitting my day job!! :) Cheers, Rob. Robb: --

Re: [PHP] More than one values returned?

2008-02-22 Thread Robert Cummings
On Fri, 2008-02-22 at 09:50 -0600, Greg Donald wrote: On 2/21/08, Nick Stinemates [EMAIL PROTECTED] wrote: I'm glad you're literate enough to understand what *indication* and *usually* mean. I know perfectly well what they mean, both words in fact. What I, and many others I can only

Re: [PHP] More than one values returned?

2008-02-22 Thread Greg Donald
On 2/21/08, Nick Stinemates [EMAIL PROTECTED] wrote: I'm glad you're literate enough to understand what *indication* and *usually* mean. I know perfectly well what they mean, both words in fact. What I, and many others I can only assume, are waiting for, is one shred of an example to back up

Re: [PHP] More than one values returned?

2008-02-22 Thread tedd
At 9:50 AM -0600 2/22/08, Greg Donald wrote: On 2/21/08, Nick Stinemates [EMAIL PROTECTED] wrote: -snip- for no importance I am indeed waiting, where's your code? When, and under what circumstances exactly, is getting back an array of objects from a function or method call poor design ?

Re: [PHP] More than one values returned?

2008-02-22 Thread Robert Cummings
On Fri, 2008-02-22 at 13:09 -0500, tedd wrote: At 9:50 AM -0600 2/22/08, Greg Donald wrote: On 2/21/08, Nick Stinemates [EMAIL PROTECTED] wrote: -snip- for no importance I am indeed waiting, where's your code? When, and under what circumstances exactly, is getting back an array of objects

Re: [PHP] More than one values returned?

2008-02-22 Thread Daniel Brown
On Fri, Feb 22, 2008 at 3:05 PM, Robert Cummings [EMAIL PROTECTED] wrote: I for 1 think you're full of it :) Don't be a 0. ;-P -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] More than one values returned?

2008-02-22 Thread Robert Cummings
On Fri, 2008-02-22 at 15:11 -0500, Daniel Brown wrote: On Fri, Feb 22, 2008 at 3:05 PM, Robert Cummings [EMAIL PROTECTED] wrote: I for 1 think you're full of it :) Don't be a 0. ;-P I'm a 0 hero! :B Cheers, Rob. -- .. |

Re: [PHP] More than one values returned?

2008-02-22 Thread Daniel Brown
On Fri, Feb 22, 2008 at 3:27 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2008-02-22 at 15:11 -0500, Daniel Brown wrote: On Fri, Feb 22, 2008 at 3:05 PM, Robert Cummings [EMAIL PROTECTED] wrote: I for 1 think you're full of it :) Don't be a 0. ;-P I'm a 0 hero!

Re: [PHP] More than one values returned?

2008-02-22 Thread Robert Cummings
On Fri, 2008-02-22 at 15:29 -0500, Daniel Brown wrote: On Fri, Feb 22, 2008 at 3:27 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2008-02-22 at 15:11 -0500, Daniel Brown wrote: On Fri, Feb 22, 2008 at 3:05 PM, Robert Cummings [EMAIL PROTECTED] wrote: I for 1 think you're

Re: [PHP] More than one values returned?

2008-02-22 Thread Daniel Brown
On Fri, Feb 22, 2008 at 3:36 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2008-02-22 at 15:11 -0500, Daniel Brown wrote: And I'm an L7. With 0 percent success probability... once again 0 saves the day!! Ouch. You hit me right in the feel-bads. -- /Dan Daniel P.

Re: [PHP] More than one values returned?

2008-02-22 Thread Robert Cummings
On Fri, 2008-02-22 at 15:36 -0500, Daniel Brown wrote: On Fri, Feb 22, 2008 at 3:36 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2008-02-22 at 15:11 -0500, Daniel Brown wrote: And I'm an L7. With 0 percent success probability... once again 0 saves the day!!

Re: [PHP] More than one values returned?

2008-02-22 Thread Nathan Nobbe
i for one have mixed feelings on this issue. im tempted to agree w/ nick, but not entirely. my stance is this; implementing the iterator or related interfaces is transparent to client code; namely you can still use for each to traverse the collection. you also get to do things during the

Re: [PHP] More than one values returned?

2008-02-22 Thread Jim Lucas
Robert Cummings wrote: On Fri, 2008-02-22 at 15:11 -0500, Daniel Brown wrote: On Fri, Feb 22, 2008 at 3:05 PM, Robert Cummings [EMAIL PROTECTED] wrote: I for 1 think you're full of it :) Don't be a 0. ;-P I'm a 0 hero! :B Cheers, Rob. My daughter called me her Zero Hero when she

Re: [PHP] More than one values returned?

2008-02-22 Thread Robert Cummings
On Fri, 2008-02-22 at 17:04 -0500, Nathan Nobbe wrote: i for one have mixed feelings on this issue. im tempted to agree w/ nick, but not entirely. my stance is this; implementing the iterator or related interfaces is transparent to client code; namely you can still use for each to traverse

Re: [PHP] More than one values returned?

2008-02-22 Thread tedd
At 5:27 PM -0500 2/22/08, Robert Cummings wrote: On Fri, 2008-02-22 at 17:04 -0500, Nathan Nobbe wrote: and btw; your narratives are are just damned hilarious rob ;) Take that Ted... I'm quitting my day job!! :) Cheers, Rob. Robb: -- note the addition of an extra 'b' for my loss of a 'd'

Re: [PHP] More than one values returned?

2008-02-22 Thread Nathan Nobbe
On Fri, Feb 22, 2008 at 6:13 PM, tedd [EMAIL PROTECTED] wrote: At 5:27 PM -0500 2/22/08, Robert Cummings wrote: On Fri, 2008-02-22 at 17:04 -0500, Nathan Nobbe wrote: and btw; your narratives are are just damned hilarious rob ;) Take that Ted... I'm quitting my day job!! :) Cheers,

Re: [PHP] More than one values returned?

2008-02-21 Thread Greg Donald
On 2/19/08, Nick Stinemates [EMAIL PROTECTED] wrote: I said, simply, returning an array of objects was usually an indication of poor design. No it's not. Nearly every MVC framework in existence implements some sort of ActiveRecord finder that does exactly that. Rails: @foo = Foo.find( :all

Re: [PHP] More than one values returned?

2008-02-21 Thread Nick Stinemates
Greg Donald wrote: On 2/19/08, Nick Stinemates [EMAIL PROTECTED] wrote: I said, simply, returning an array of objects was usually an indication of poor design. No it's not. Nearly every MVC framework in existence implements some sort of ActiveRecord finder that does exactly

Re: [PHP] More than one values returned?

2008-02-20 Thread Jim Lucas
Nick Stinemates wrote: Nathan Rixham wrote: Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or

Re: [PHP] More than one values returned?

2008-02-20 Thread Nathan Nobbe
On Wed, Feb 20, 2008 at 1:38 AM, Robert Cummings [EMAIL PROTECTED] wrote: Actually, using foreach on an array has less overhead than an iterator on an object. yes they are; see my experiment results here, http://nathan.moxune.com/arrayVsArrayIteratorReport.php and i hear what youre saying

Re: [PHP] More than one values returned?

2008-02-20 Thread Nathan Nobbe
On Mon, Feb 18, 2008 at 9:06 PM, Nick Stinemates [EMAIL PROTECTED] wrote: 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

Re: [PHP] More than one values returned?

2008-02-20 Thread tedd
At 9:24 PM -0800 2/19/08, Nick Stinemates wrote: Not once did I knock By Reference value passing or pointers. I said, simply, returning an array of objects was usually an indication of poor design. And the difference between a variable, an object, an array, and a pointer is? Look, they all

Re: [PHP] More than one values returned?

2008-02-20 Thread Nick Stinemates
Jim Lucas wrote: Nick Stinemates wrote: Nathan Rixham wrote: Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: I have found, however, that if I ever need to return /multiple/ values, it's usually because of

Re: [PHP] More than one values returned?

2008-02-20 Thread Nick Stinemates
Nathan Nobbe wrote: On Mon, Feb 18, 2008 at 9:06 PM, Nick Stinemates [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: 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

Re: [PHP] More than one values returned?

2008-02-20 Thread Jim Lucas
Nick Stinemates wrote: Jim Lucas wrote: Nick Stinemates wrote: Nathan Rixham wrote: Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: I have found, however, that if I ever need to return /multiple/ values,

Re: [PHP] More than one values returned?

2008-02-19 Thread Nathan Rixham
Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: 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. You mean

Re: [PHP] More than one values returned?

2008-02-19 Thread tedd
At 6:06 PM -0800 2/18/08, Nick Stinemates wrote: 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.

RE: [PHP] More than one values returned?

2008-02-19 Thread Andrés Robinet
-Original Message- From: Nathan Rixham [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 19, 2008 5:17 AM To: php-general@lists.php.net Subject: Re: [PHP] More than one values returned? Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18

Re: [PHP] More than one values returned?

2008-02-19 Thread Nick Stinemates
Nathan Rixham wrote: Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: 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

Re: [PHP] More than one values returned?

2008-02-19 Thread Greg Donald
On 2/18/08, Robert Cummings [EMAIL PROTECTED] wrote: I'd just return arrays unless I had a specific need for incurring object overhead for such simple datatypes. w0rd. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] More than one values returned?

2008-02-19 Thread Greg Donald
On 2/18/08, Nick Stinemates [EMAIL PROTECTED] wrote: 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. Yeah, that's probably why most popular scripting languages support it. In Ruby: def foo 1,

Re: [PHP] More than one values returned?

2008-02-19 Thread Steve Edberg
At 4:57 PM -0600 2/19/08, Greg Donald wrote: On 2/18/08, Nick Stinemates [EMAIL PROTECTED] wrote: 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. Yeah, that's probably why most popular

Re: [PHP] More than one values returned?

2008-02-19 Thread Greg Donald
On Feb 19, 2008 5:23 PM, Steve Edberg [EMAIL PROTECTED] wrote: For completeness sake, this is pretty much the same in PHP: function test() { return array(1,2); } list($a,$b) = test(); Yup, just a few more keystrokes is all. -- Greg Donald http://destiney.com/ -- PHP

Re: [PHP] More than one values returned?

2008-02-19 Thread Nick Stinemates
Greg Donald wrote: On 2/18/08, Nick Stinemates [EMAIL PROTECTED] wrote: 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. Yeah, that's probably why most popular scripting languages

Re: [PHP] More than one values returned?

2008-02-19 Thread Greg Donald
On Feb 19, 2008 9:27 PM, Nick Stinemates [EMAIL PROTECTED] wrote: Support != good design habits. So you presume to have better design habits than the many language designers who implemented parallel assignment in their respective language? Right.

Re: [PHP] More than one values returned?

2008-02-19 Thread Nathan Nobbe
On Feb 19, 2008 11:52 PM, Greg Donald [EMAIL PROTECTED] wrote: On Feb 19, 2008 9:27 PM, Nick Stinemates [EMAIL PROTECTED] wrote: Support != good design habits. So you presume to have better design habits than the many language designers who implemented parallel assignment in their

Re: [PHP] More than one values returned?

2008-02-19 Thread Nick Stinemates
Nathan Nobbe wrote: On Feb 19, 2008 11:52 PM, Greg Donald [EMAIL PROTECTED] wrote: On Feb 19, 2008 9:27 PM, Nick Stinemates [EMAIL PROTECTED] wrote: Support != good design habits. So you presume to have better design habits than the many language designers who implemented

Re: [PHP] More than one values returned?

2008-02-19 Thread Robert Cummings
On Tue, 2008-02-19 at 21:24 -0800, Nick Stinemates wrote: I said, simply, returning an array of objects was usually an indication of poor design. Please elaborate as to the why of it being an indication of poor design. Cheers, Rob. --

Re: [PHP] More than one values returned?

2008-02-19 Thread Nick Stinemates
Robert Cummings wrote: On Tue, 2008-02-19 at 21:24 -0800, Nick Stinemates wrote: I said, simply, returning an array of objects was usually an indication of poor design. Please elaborate as to the why of it being an indication of poor design. Cheers, Rob. I already did... I

Re: [PHP] More than one values returned?

2008-02-19 Thread Nick Stinemates
Robert Cummings wrote: On Tue, 2008-02-19 at 21:51 -0800, Nick Stinemates wrote: Robert Cummings wrote: On Tue, 2008-02-19 at 21:24 -0800, Nick Stinemates wrote: I said, simply, returning an array of objects was usually an indication of poor design.

Re: [PHP] More than one values returned?

2008-02-19 Thread Robert Cummings
On Tue, 2008-02-19 at 21:51 -0800, Nick Stinemates wrote: Robert Cummings wrote: On Tue, 2008-02-19 at 21:24 -0800, Nick Stinemates wrote: I said, simply, returning an array of objects was usually an indication of poor design. Please elaborate as to the why of it being an

Re: [PHP] More than one values returned?

2008-02-19 Thread Robert Cummings
On Tue, 2008-02-19 at 22:26 -0800, Nick Stinemates wrote: Robert Cummings wrote: On Tue, 2008-02-19 at 21:51 -0800, Nick Stinemates wrote: Robert Cummings wrote: On Tue, 2008-02-19 at 21:24 -0800, Nick Stinemates wrote: I said, simply, returning an array of

Re: [PHP] More than one values returned?

2008-02-18 Thread Brady Mitchell
On Feb 18, 2008, at 531PM, Teck wrote: Is it possible to return more than one values in PHP? Yes, in the form of an array. return $x; return $y; Only one return statement can be used. http://us.php.net/manual/en/functions.returning-values.php Brady -- PHP General Mailing List

Re: [PHP] More than one values returned?

2008-02-18 Thread TG
You can't return more than one variable, but you can return an array that contains multiple values. $x = array('val1', 'val2'); return $x; -TG - Original Message - From: Teck [EMAIL PROTECTED] To: php-general@lists.php.net Date: Tue, 19 Feb 2008 10:31:02 +0900 Subject: [PHP] More

Re: [PHP] More than one values returned?

2008-02-18 Thread Larry Garfield
On Monday 18 February 2008, Teck wrote: Hi, Is it possible to return more than one values in PHP? return $x; return $y; They don't work for me. -T A function always returns a single value. That value can be an array. function foo() { return array(1, 2); } list($a, $b) = foo(); --

Re: [PHP] More than one values returned?

2008-02-18 Thread C.R.Vegelin
?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 - Original Message - From: Teck [EMAIL PROTECTED] To: php-general@lists.php.net

Re: [PHP] More than one values returned?

2008-02-18 Thread Nick Stinemates
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

Re: [PHP] More than one values returned?

2008-02-18 Thread Robert Cummings
On Mon, 2008-02-18 at 18:06 -0800, Nick Stinemates wrote: 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;

Re: [PHP] More than one values returned?

2008-02-18 Thread Nick Stinemates
Robert Cummings wrote: On Mon, 2008-02-18 at 18:06 -0800, Nick Stinemates wrote: 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;

Re: [PHP] More than one values returned?

2008-02-18 Thread Robert Cummings
On Mon, 2008-02-18 at 18:29 -0800, Nick Stinemates wrote: Robert Cummings wrote: On Mon, 2008-02-18 at 18:06 -0800, Nick Stinemates wrote: C.R.Vegelin wrote: ?php $in = 4; calcpows($in, $pow2, $pow4); echo in = $in pow2=$pow2 pow4=$pow4; // define return fields as

Re: [PHP] More than one values returned?

2008-02-18 Thread Larry Garfield
On Monday 18 February 2008, Nick Stinemates wrote: 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. You mean you've never had a function like getCoordinates()? Or getUsers(), or any

Re: [PHP] More than one values returned?

2008-02-18 Thread Robert Cummings
On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: 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. You mean you've never

RE: [PHP] More than one values returned?

2008-02-18 Thread Bastien Koert
return an array bastien From: [EMAIL PROTECTED] To: php-general@lists.php.net Date: Tue, 19 Feb 2008 10:31:02 +0900 Subject: [PHP] More than one values returned? Hi, Is it possible to return more than one values in PHP? return $x; return $y; They don't work for me. -T -- PHP General