At 2:18 PM -0600 1/13/09, Micah Gersten wrote:
Jochem Maas wrote:
switch (true) {
case ($x === $y):
// something
break;
This is a misuse of the switch statement. Switch is meant to compare
values to a single variable as stated on the manual page:
Ashley Sheridan schreef:
On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on
switch or elseif seperately. :(
Strictly from a performance stand point, not
On Tue, Jan 13, 2009 at 9:50 AM, Jochem Maas joc...@iamjochem.com wrote:
switch (true) {
case ($x === $y):
// something
break;
case ($a != $b):
// something
break;
case (myFunc()):
//
On Tue, 2009-01-13 at 15:50 +0100, Jochem Maas wrote:
Ashley Sheridan schreef:
On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on
switch or elseif seperately.
Jochem Maas wrote:
switch (true) {
case ($x === $y):
// something
break;
case ($a != $b):
// something
break;
case (myFunc()):
// something
break;
case
I think if they didn't want us to use expressions in the case, then they
wouldn't have put support into the language for that.
I daresay you are reading more into the text than was intended...
I certainly have found switch(true) with complex expressions for case quite
handy and very clear
Micah Gersten schreef:
Jochem Maas wrote:
switch (true) {
case ($x === $y):
// something
break;
case ($a != $b):
// something
break;
case (myFunc()):
// something
break;
case
Jochem Maas wrote:
Micah Gersten schreef:
Jochem Maas wrote:
switch (true) {
should be switch(false) {
:-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Robert Cummings schreef:
On Tue, 2009-01-13 at 15:50 +0100, Jochem Maas wrote:
Ashley Sheridan schreef:
On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on
switch
Nathan Rixham schreef:
Jochem Maas wrote:
Micah Gersten schreef:
Jochem Maas wrote:
switch (true) {
should be switch(false) {
:-)
it could be either depending on your needs, no?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Micah Gersten wrote:
Jochem Maas wrote:
switch (true) {
case ($x === $y):
// something
break;
case ($a != $b):
// something
break;
case (myFunc()):
// something
break;
case
On Tue, 2009-01-13 at 22:12 +0100, Jochem Maas wrote:
Robert Cummings schreef:
On Tue, 2009-01-13 at 15:50 +0100, Jochem Maas wrote:
Ashley Sheridan schreef:
On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote:
I've googled, and found some confusing answers.
I've tried searching
I regret that I don't recall who made the brilliant observation that
programmers spend the majority of their time *reading* code (their own or
others) as opposed to *writing* code.
So, I make it a point to try to make my code easily scannable. I only and
always use the switch construct when
On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
blindspot...@comcast.net wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on
switch or elseif seperately. :(
Strictly from a performance stand point, not preference
On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on
switch or elseif seperately. :(
Strictly from a performance stand point, not preference or anything else, is
On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on
switch or elseif seperately. :(
Strictly from a performance stand point, not preference or anything else, is
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1231793310.3558.55.ca...@localhost.localdomain...
On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info
Eric Butera eric.but...@gmail.com wrote in message
news:6a8639eb0901121231r253eed48xe1974d8ef44ab...@mail.gmail.com...
On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
blindspot...@comcast.net wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news
On Mon, Jan 12, 2009 at 3:58 PM, Frank Stanovcak
blindspot...@comcast.net wrote:
Eric Butera eric.but...@gmail.com wrote in message
news:6a8639eb0901121231r253eed48xe1974d8ef44ab...@mail.gmail.com...
On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
blindspot...@comcast.net wrote:
I've
On Mon, 2009-01-12 at 15:31 -0500, Eric Butera wrote:
On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
blindspot...@comcast.net wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on
switch or elseif seperately.
On Mon, Jan 12, 2009 at 4:00 PM, Daevid Vincent dae...@daevid.com wrote:
On Mon, 2009-01-12 at 15:31 -0500, Eric Butera wrote:
On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
blindspot...@comcast.net wrote:
I've googled, and found some confusing answers.
I've tried searching the history
At 3:15 PM -0500 1/12/09, Frank Stanovcak wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on
switch or elseif seperately. :(
Strictly from a performance stand point, not preference or anything else, is
there a
At 3:32 PM -0500 1/12/09, Robert Cummings wrote:
One has to wonder about the readability of the case version though since
one may not notice immediately the missing break statement.
Cheers,
Rob.
Yes, but that's because of the way you wrote it -- consider this:
?php
switch( $foo )
{
On Mon, 2009-01-12 at 16:49 -0500, tedd wrote:
At 3:32 PM -0500 1/12/09, Robert Cummings wrote:
One has to wonder about the readability of the case version though since
one may not notice immediately the missing break statement.
Cheers,
Rob.
Yes, but that's because of the way you wrote
tedd wrote:
At 3:32 PM -0500 1/12/09, Robert Cummings wrote:
One has to wonder about the readability of the case version though since
one may not notice immediately the missing break statement.
Cheers,
Rob.
Yes, but that's because of the way you wrote it -- consider this:
I'm sure that was
On Mon, 2009-01-12 at 16:49 -0500, tedd wrote:
At 3:32 PM -0500 1/12/09, Robert Cummings wrote:
One has to wonder about the readability of the case version though since
one may not notice immediately the missing break statement.
Cheers,
Rob.
Yes, but that's because of the way you wrote
At 4:57 PM -0500 1/12/09, Robert Cummings wrote:
No, that's DIFFERENT from what I wrote. Go back and re-read.
:)
I did and reread again -- it looks different. I'm simply talking
about the spacing.
No matter though, it's the same code.
Cheers,
tedd
--
---
http://sperling.com
On Mon, 2009-01-12 at 17:09 -0500, tedd wrote:
At 4:57 PM -0500 1/12/09, Robert Cummings wrote:
No, that's DIFFERENT from what I wrote. Go back and re-read.
:)
I did and reread again -- it looks different. I'm simply talking
about the spacing.
No matter though, it's the same code.
At 5:12 PM -0500 1/12/09, Robert Cummings wrote:
On Mon, 2009-01-12 at 17:09 -0500, tedd wrote:
At 4:57 PM -0500 1/12/09, Robert Cummings wrote:
No, that's DIFFERENT from what I wrote. Go back and re-read.
:)
I did and reread again -- it looks different. I'm simply talking
about the
29 matches
Mail list logo