Re: [PHP] IF or SWITCH (asinine?)

2006-04-07 Thread Ray Hauge
On Friday 07 April 2006 16:41, tedd wrote: > Note, it's not actually required to have a variable to be evaluated > for each case statement. Each case statement stands on it's own > independent from the evaluation. > > This has always worked for me in other languages and I am assuming > that it work

Re: [PHP] IF or SWITCH (asinine?)

2006-04-07 Thread tedd
Anyways, I think this debate is pretty much pointless now, you've clarified your point of view (sort of) and I'll just run with the final though that you limit your use of switch to case where elseif would be needed... and to clarify on my part once more, I did not call that asinine. Cheers, Rob.

Re: [PHP] IF or SWITCH (asinine?)

2006-04-07 Thread tedd
> Personally, as I said before, I use if/else for two conditions and switch for three or more. Your mileage may vary, but it's truly a > matter of choice and is not one of asinine methodology. > tedd I think that's a fairly good methodology to follow. I usually do that... except when

Re: [PHP] IF or SWITCH (asinine?)

2006-04-07 Thread Robert Cummings
On Fri, 2006-04-07 at 11:57, tedd wrote: > Ray said: > > >I'm pretty sure he's ONLY talking about IF/ELSEIF and not IF in general. > >That's what I got from the message. Correct me if I'm wrong. > > Of course, you're absolutely right -- I said specifically IF/ELSEIF. > My objection is not with

Re: [PHP] IF or SWITCH (asinine?)

2006-04-07 Thread Ray Hauge
On Friday 07 April 2006 08:57, tedd wrote: > > Personally, as I said before, I use if/else for two conditions and > switch for three or more. Your mileage may vary, but it's truly a > matter of choice and is not one of asinine methodology. > > Thanks to all who replied. > > tedd > > -- > --

Re: [PHP] IF or SWITCH (asinine?)

2006-04-07 Thread tedd
Ray said: I'm pretty sure he's ONLY talking about IF/ELSEIF and not IF in general. That's what I got from the message. Correct me if I'm wrong. Of course, you're absolutely right -- I said specifically IF/ELSEIF. My objection is not with the IF statement, of course I use that. In fact, I us

Re: [PHP] IF or SWITCH

2006-04-07 Thread Kevin Waterson
This one time, at band camp, Jad madi <[EMAIL PROTECTED]> wrote: > Kevin, > I'm just curious to know how to did you do that benchmark. Sure, use ab (Apache Benchmark) which comes with your build of apache. Simply create your file foo.php and give ab the command ab http://www.example.com/foo.php

Re: [PHP] IF or SWITCH

2006-04-07 Thread Jad madi
Kevin, I'm just curious to know how to did you do that benchmark. On Fri, 2006-04-07 at 12:40 +1000, Kevin Waterson wrote: > This one time, at band camp, Robert Cummings <[EMAIL PROTECTED]> wrote: > > > I'm gonna go out on a limb here and say WRONG! > > > > Run yourself a benchmark. > > bench

Re: [PHP] IF or SWITCH

2006-04-06 Thread Robert Cummings
On Thu, 2006-04-06 at 22:40, Kevin Waterson wrote: > This one time, at band camp, Robert Cummings <[EMAIL PROTECTED]> wrote: > > > I'm gonna go out on a limb here and say WRONG! > > > > Run yourself a benchmark. > > benchmarks can be hazardous, but lets look at them at their most basic level. >

Re: [PHP] IF or SWITCH

2006-04-06 Thread Miles Thompson
At 11:40 PM 4/6/2006, Kevin Waterson wrote: This one time, at band camp, Robert Cummings <[EMAIL PROTECTED]> wrote: > I'm gonna go out on a limb here and say WRONG! > > Run yourself a benchmark. benchmarks can be hazardous, but lets look at them at their most basic level. By this I mean how

Re: [PHP] IF or SWITCH

2006-04-06 Thread Kevin Waterson
This one time, at band camp, Robert Cummings <[EMAIL PROTECTED]> wrote: > I'm gonna go out on a limb here and say WRONG! > > Run yourself a benchmark. benchmarks can be hazardous, but lets look at them at their most basic level. By this I mean how folks use them every day... http://www.phpro.o

Re: [PHP] IF or SWITCH

2006-04-06 Thread Miles Thompson
At 05:56 PM 4/6/2006, John Nichel wrote: I remember IF constructs from BASIC and PASCAL, but no switch statements (somebody correct me if I'm wrong). But what I'm wondering is how in the world did you do conditional checking if there were no switches, and you don't use IF's? Did you not cod

Re: [PHP] IF or SWITCH

2006-04-06 Thread Ray Hauge
On Thursday 06 April 2006 11:20, tedd wrote: > At 1:04 PM -0400 4/6/06, Robert Cummings wrote: > >On Thu, 2006-04-06 at 11:50, tedd wrote: > >> Regardless of speed, I find that switch is much easier to write and > >> debug than if/elseif -- which, regardless of my shortcomings, I never > >> use.

Re: [PHP] IF or SWITCH

2006-04-06 Thread John Nichel
tedd wrote: At 1:04 PM -0400 4/6/06, Robert Cummings wrote: On Thu, 2006-04-06 at 11:50, tedd wrote: Regardless of speed, I find that switch is much easier to write and debug than if/elseif -- which, regardless of my shortcomings, I never use. Umm, that you NEVER use elseif I think is str

Re: [PHP] IF or SWITCH

2006-04-06 Thread Robert Cummings
On Thu, 2006-04-06 at 14:20, tedd wrote: > At 1:04 PM -0400 4/6/06, Robert Cummings wrote: > > So, my programming probably predates both conditions -- however -- in > 40 years I have NEVER used an if/elseif control structure by any name > and I always found a way around it -- and one that was usu

Re: [PHP] IF or SWITCH

2006-04-06 Thread tedd
At 1:04 PM -0400 4/6/06, Robert Cummings wrote: On Thu, 2006-04-06 at 11:50, tedd wrote: Regardless of speed, I find that switch is much easier to write and debug than if/elseif -- which, regardless of my shortcomings, I never use. Umm, that you NEVER use elseif I think is strongly coupled

Re: [PHP] IF or SWITCH

2006-04-06 Thread Paul Novitski
At 07:48 PM 4/5/2006, Ray Hauge wrote: I have 57 if/elseif/else statements because of all the different criteria. Is it considered better programming practice to use if/elseif/else statements over a switch(true) case (true && false || true || false) syntax? Here are two seemingly contradicto

Re: [PHP] IF or SWITCH

2006-04-06 Thread Robert Cummings
On Thu, 2006-04-06 at 11:50, tedd wrote: > > Regardless of speed, I find that switch is much easier to write and > debug than if/elseif -- which, regardless of my shortcomings, I never > use. Umm, that you NEVER use elseif I think is strongly coupled with your shortcomings :l But I'm not judging

Re: [PHP] IF or SWITCH

2006-04-06 Thread Robert Cummings
On Thu, 2006-04-06 at 09:08, John Wells wrote: > > ...Either way, > > internally, switch behaves like if/elseif/else and generally only > > provides an advantage with respect to code organization or if you want a > > particular condition to drop through to other case blocks. > > > > Considering th

RE: [PHP] IF or SWITCH

2006-04-06 Thread ray . hauge
> Original Message > Subject: Re: [PHP] IF or SWITCH > From: "John Wells" <[EMAIL PROTECTED]> > Date: Thu, April 06, 2006 6:08 am > To: php-general@lists.php.net > > > ...Either way, > > internally, switch behaves like if/

Re: [PHP] IF or SWITCH

2006-04-06 Thread tedd
At 7:48 PM -0700 4/5/06, Ray Hauge wrote: Hello World! wait, not coding... (sorry, long night) Okay, I finally finished hashing out all the logic for a very complex set of rules to determine what "type" an application should be set to. I won't bore you with the details of it, but the question i

Re: [PHP] IF or SWITCH

2006-04-06 Thread Joe Wollard
On 4/6/06, Robert Cummings <[EMAIL PROTECTED]> wrote: > > On Thu, 2006-04-06 at 02:29, Joe Wollard wrote: > > The main perk to using switch over if > > statements is speed (Google can back this up). The reason it's faster is > > because it's simpler by design and is able to jump directly to the cas

Re: [PHP] IF or SWITCH

2006-04-06 Thread John Wells
> ...Either way, > internally, switch behaves like if/elseif/else and generally only > provides an advantage with respect to code organization or if you want a > particular condition to drop through to other case blocks. > Considering this is regarding an if/else with ***57*** conditional checks,

Re: [PHP] IF or SWITCH

2006-04-06 Thread Robert Cummings
On Thu, 2006-04-06 at 03:06, Joe Wollard wrote: > > um. Did you just stick you tounge out at me? (jk) Actually, Rob brings Yes, though I forgot the smiley as I'm apt to do :) > up a good point. switch statements are not always faster. Here's an > example from > http://www.php.net/manual/en/contr

Re: [PHP] IF or SWITCH

2006-04-06 Thread Oli Howson
The main perk to using switch over if statements is speed speed of development and ease of reading. Otherwise, it all ends up the same under the bonnet afaik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] IF or SWITCH

2006-04-06 Thread Robert Cummings
On Thu, 2006-04-06 at 02:29, Joe Wollard wrote: > The main perk to using switch over if > statements is speed (Google can back this up). The reason it's faster is > because it's simpler by design and is able to jump directly to the case that > evaluates to true, whereas an if statement needs to eva

Re: [PHP] IF or SWITCH

2006-04-05 Thread Joe Wollard
On 4/5/06, Ray Hauge <[EMAIL PROTECTED]> wrote: > > Hello World! wait, not coding... (sorry, long night) > > Okay, I finally finished hashing out all the logic for a very complex set > of > rules to determine what "type" an application should be set to. I won't > bore > you with the details of it,

RE: [PHP] IF or SWITCH

2006-04-05 Thread ray . hauge
> Original Message > Subject: Re: [PHP] IF or SWITCH > From: Chris <[EMAIL PROTECTED]> > Date: Wed, April 05, 2006 8:32 pm > To: Ray Hauge <[EMAIL PROTECTED]> > Cc: PHP-General > > Ray Hauge wrote: > > Hello World! wait, not codi

Re: [PHP] IF or SWITCH

2006-04-05 Thread Jochem Maas
Chris wrote: Ray Hauge wrote: Hello World! wait, not coding... (sorry, long night) ... if ($count_lenders > 1) I would take it even further and setup a load of variables that hold the boolean states that you what to check in the 50 odd if/else statements... something like: $ffelpEQ

Re: [PHP] IF or SWITCH

2006-04-05 Thread Chris
Ray Hauge wrote: Hello World! wait, not coding... (sorry, long night) Okay, I finally finished hashing out all the logic for a very complex set of rules to determine what "type" an application should be set to. I won't bore you with the details of it, but the question is... I have 57 if/els

Re: [PHP] IF or SWITCH

2006-04-05 Thread Ray Hauge
On Wednesday 05 April 2006 20:11, Robert Cummings wrote: > Well I'd use if/elseif/else but I don't format like you... > > if( $numFFELP > 1 > && > count( $FFELP_Lenders ) > 1 > && > $numFFELP == $numTotal ) > { > $retVal = array( TRUE, 'A' ); > } > else > if( $numFFELP > 0 >

Re: [PHP] IF or SWITCH

2006-04-05 Thread Robert Cummings
On Wed, 2006-04-05 at 22:48, Ray Hauge wrote: > Hello World! wait, not coding... (sorry, long night) > > Okay, I finally finished hashing out all the logic for a very complex set of > rules to determine what "type" an application should be set to. I won't bore > you with the details of it, but