Timeline for problem on switch case
Current License: CC BY-SA 2.5
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 14, 2012 at 6:00 | comment | added | Craig Ringer | I'm impressed you interpreted the gibberish of that question well enough to give a good answer ;-) | |
Apr 6, 2011 at 9:48 | history | edited | KingCrunch | CC BY-SA 2.5 |
added 1 characters in body
|
Apr 6, 2011 at 9:38 | comment | added | KingCrunch |
@deceze: Just realized: With pathinfo() a much cleaner solution (in I think our both oppinions ;)) is possible. See update in answer. This way it feels exactly, what switch is designed for.
|
|
Apr 6, 2011 at 9:38 | history | edited | KingCrunch | CC BY-SA 2.5 |
added 257 characters in body; added 62 characters in body
|
Apr 6, 2011 at 9:37 | comment | added | deceze♦ |
@King Hehe, must be switch -Wednesday today. ;-) Looking at the OP's code I kinda don't expect him to be using true as the switch expression though...
|
|
Apr 6, 2011 at 9:34 | comment | added | KingCrunch | @deceze: I already had such a discussion here today stackoverflow.com/questions/5563079/… See the comments :) I dont see, that this is some kind of abusing and in my oppinion its more readable with many similar expressions, so I prefer the readability against the dogma :) | |
Apr 6, 2011 at 9:26 | comment | added | deceze♦ |
@King IMO switch(true) is abusing the switch statement and would be better replaced with an if . Maybe that's just me though.
|
|
Apr 6, 2011 at 9:24 | comment | added | KingCrunch |
@deceze: Hmm.. valid point. Maybe I guessed a little bit too much. But what is weird with switch(true) ?
|
|
Apr 6, 2011 at 9:21 | comment | added | deceze♦ | @King Sure, but that would be just as weird and needs pointing out. | |
Apr 6, 2011 at 9:17 | comment | added | KingCrunch |
@deceze: The questioner omitted the switch($expr) -part, so I had to guess. Maybe its just switch(true) .
|
|
Apr 6, 2011 at 9:07 | comment | added | deceze♦ |
If this is indeed used as a switch case , this will not work like you expect it to work. If it works at all, it's just because the result of that expression happens to loosely compare to the switch comparison value.
|
|
Apr 6, 2011 at 8:58 | vote | accept | Abudayah | ||
Apr 6, 2011 at 8:51 | history | edited | KingCrunch | CC BY-SA 2.5 |
added 233 characters in body
|
Apr 6, 2011 at 8:44 | history | answered | KingCrunch | CC BY-SA 2.5 |