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:
http://us
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 eva
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
Micah Gersten wrote:
> Jochem Maas wrote:
>> switch (true) {
>> case ($x === $y):
>> // something
>> break;
>>
>> case ($a != $b):
>> // something
>> break;
>>
>> case (myFunc()):
>> // something
>> break;
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
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 inf
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
Micah Gersten schreef:
> Jochem Maas wrote:
>> switch (true) {
>> case ($x === $y):
>> // something
>> break;
>>
>> case ($a != $b):
>> // something
>> break;
>>
>> case (myFunc()):
>> // something
>> break
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
Jochem Maas wrote:
> switch (true) {
> case ($x === $y):
> // something
> break;
>
> case ($a != $b):
> // something
> break;
>
> case (myFunc()):
> // something
> break;
>
> case ($my->getCh
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
On Tue, Jan 13, 2009 at 9:50 AM, Jochem Maas wrote:
> switch (true) {
>case ($x === $y):
>// something
>break;
>
>case ($a != $b):
>// something
>break;
>
>case (myFunc()):
>// something
>
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, n
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 s
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 sam
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 http://
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
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
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:
If you group the case's togeth
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 benefi
On Mon, Jan 12, 2009 at 4:00 PM, Daevid Vincent wrote:
> On Mon, 2009-01-12 at 15:31 -0500, Eric Butera wrote:
>
>> On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
>> wrote:
>> > I've googled, and found some confusing answers.
>> > I've tried searching the history of the news group, and only fou
On Mon, 2009-01-12 at 15:31 -0500, Eric Butera wrote:
> On Mon, Jan 12, 2009 at 3:15 PM, 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. :(
> >
> > Strictl
On Mon, Jan 12, 2009 at 3:58 PM, Frank Stanovcak
wrote:
>
> ""Eric Butera"" wrote in message
> news:6a8639eb0901121231r253eed48xe1974d8ef44ab...@mail.gmail.com...
>> On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
>> wrote:
>>> I've googled, and found some confusing answers.
>>> I've tried sear
""Eric Butera"" wrote in message
news:6a8639eb0901121231r253eed48xe1974d8ef44ab...@mail.gmail.com...
> On Mon, Jan 12, 2009 at 3:15 PM, 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
>
"Ashley Sheridan" 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
>> on
>> switch or el
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,
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,
On Mon, Jan 12, 2009 at 3:15 PM, 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
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 benefit of one over the other?
for($i=0;$i<3;$i++){
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 benefit of one over the other?
for($i=0;$i<3;$i++){
31 matches
Mail list logo