<br>I&#39;m not took concerned about readability.&nbsp; I already code in the style of spaghetti, so cleanliness is not my first concern.&nbsp; I think I might break the switch into chunks of 20, and then use a single if statement to determine which switch to compare the variable against.<br>
<br>Thanks for the replies though.<br><br>Bob, I know not of this &#39;C&#39; you language speak of... unless you forgot to add the &#39;#&#39; after it ;)<br><br>-Rob<br><br><div class="gmail_quote">On Thu, Feb 21, 2008 at 1:11 PM, Robert Meyer &lt;<a href="mailto:meyer_rm@yahoo.com">meyer_rm@yahoo.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Well, if you write the code in C, just create an array of addresses of arrays and just directly access the array by position.&nbsp; Then you don&#39;t even need any comparisons. :-)<br>
<br>Cheers!<br><br>Bob<br><div>&nbsp;</div>--<br>&quot;When once you have tasted flight, you will forever walk the earth with your eyes turned skyward, for there you have been, and there you will always long to return.&quot;<br>
   --Leonardo da Vinci<div><div></div><div class="Wj3C7c"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
----- Original Message ----<br>From: Franklin Kumro Jr &lt;<a href="mailto:fkumro@gmail.com" target="_blank">fkumro@gmail.com</a>&gt;<br>To: <a href="mailto:nflug@nflug.org" target="_blank">nflug@nflug.org</a><br>Sent: Thursday, February 21, 2008 12:18:07 PM<br>
Subject: Re: [nflug] PHP (switch vs. nested if)<br><br>

would 
agree 
that 

switch 
statement 
would 
be 
the 
preferred 
method.&nbsp; <br>Multiple 
nested 
if 
statements 
hurt 
code 
readability, 
let 
alone 

1-80&nbsp; <br>range.<br><br>-Frank<br>On 
Feb 
21, 
2008, 
at 
11:43 
AM, 
Timothy 
Finucane 
wrote:<br><br>&gt; 

switch 
is 
the 
most 
efficient 
method. 
I&#39;m 
not 
sure 
how 
much 
speed&nbsp; <br>&gt; 
performance 
is 
affected, 
but 
nested 
ifs 
would 
make 
the 
code&nbsp; <br>&gt; 
difficult 
to 
read.<br>&gt;<br>&gt; 
-- <br>&gt; 
Timothy 
J. 
Finucane<br>&gt;<br>&gt; 
<a href="http://www.speljamr.com" target="_blank">http://www.speljamr.com</a><br>&gt;<br>&gt; 
Facebook: 
<a href="http://www.facebook.com/p/Timothy_J_Finucane/682422189" target="_blank">http://www.facebook.com/p/Timothy_J_Finucane/682422189</a><br>&gt;<br>&gt;<br>&gt;<br>&gt; 
On 
2/21/08, 
Rob 
Dege 
&lt;<a href="mailto:livemotion@gmail.com" target="_blank">livemotion@gmail.com</a>&gt; 
wrote:<br>&gt; 
Hi, 
I&#39;m 
wondering 
which 
would 
provide 
faster 
processing 
time 
based&nbsp; <br>&gt; 
on 
the 
web 
page 
I&#39;m 
building.<br>&gt;<br>&gt; 

have 

variable, 
let&#39;s 
call 
it 
$num.&nbsp; 
$num 
is 
an 
int 
that 
can 
be&nbsp; <br>&gt; 
anywhere 
from 

to 
80.&nbsp; 
Based 
on 
$num&#39;s 
value, 
an 
array 
is 
assigned&nbsp; <br>&gt; 
that 
is 
then 
used 
on 
the 
web 
page.&nbsp; 
Since 
this 
is 
for 

web 
page, 
I&nbsp; <br>&gt; 
want 
to 
minimize 
the 
wait 
time 
as 
much 
as 
possible, 
and 
I&#39;m 
guessing&nbsp; <br>&gt; 
that 
this 
could 
be 

potential 
bottleneck.&nbsp; 

have 
not 
written 
the&nbsp; <br>&gt; 
code 
yet, 
so 

can&#39;t 
compare 
load 
times.&nbsp; 
I&#39;m 
considering 
this 
more&nbsp; <br>&gt; 
of 

&quot;do 
it 
the 
preferred 
way 
the 
first 
time&quot;.<br>&gt;<br>&gt; 
So 
I&#39;m 
curious 
as 
to 
which 
would 
be 
faster, 

simple 
switch 
with 
80&nbsp; <br>&gt; 
possible 
cases, 
or 

&quot;nested 
if&quot; 
that 
uses 

sorting 
algorithm;&nbsp; 
or&nbsp; <br>&gt; 
perhaps 
even 
more 
plausible, 

combination 
of 
the 
two.<br>&gt;<br>&gt; 
Any 
random 
thoughts 
are 
appreciated 
:)<br>&gt;<br>&gt; 
-- <br>&gt; 
-Rob<br>&gt;<br>&gt; 
Ben 
Franklin 
Quote: 
&quot;They 
that 
can 
give 
up 
essential 
liberty 
to&nbsp; <br>&gt; 
obtain 

little 
temporary 
safety 
deserve 
neither 
liberty 
nor 
safety.&quot;<br>&gt; 
_______________________________________________<br>&gt; 
nflug 
mailing 
list<br>&gt; 
<a href="mailto:nflug@nflug.org" target="_blank">nflug@nflug.org</a><br>&gt; 
<a href="http://www.nflug.org/mailman/listinfo/nflug" target="_blank">http://www.nflug.org/mailman/listinfo/nflug</a><br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt; 
_______________________________________________<br>&gt; 
nflug 
mailing 
list<br>&gt; 
<a href="mailto:nflug@nflug.org" target="_blank">nflug@nflug.org</a><br>&gt; 
<a href="http://www.nflug.org/mailman/listinfo/nflug" target="_blank">http://www.nflug.org/mailman/listinfo/nflug</a><br><br>_______________________________________________<br>nflug 
mailing 
list<br><a href="mailto:nflug@nflug.org" target="_blank">nflug@nflug.org</a><br><a href="http://www.nflug.org/mailman/listinfo/nflug" target="_blank">http://www.nflug.org/mailman/listinfo/nflug</a><br></div><br></div></div>
</div></div><div class="WgoR0d"><br>
      <hr size="1">Looking for last minute shopping deals? <a href="http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping" target="_blank"> 
Find them fast with Yahoo! Search.</a></div></div><br>_______________________________________________<br>
nflug mailing list<br>
<a href="mailto:nflug@nflug.org">nflug@nflug.org</a><br>
<a href="http://www.nflug.org/mailman/listinfo/nflug" target="_blank">http://www.nflug.org/mailman/listinfo/nflug</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>-Rob<br><br>Ben Franklin Quote: &quot;They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.&quot;