<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><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't even need any comparisons. :-)<br><br>Cheers!<br><br>Bob<br><div>&nbsp;</div>--<br>"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."<br>   --Leonardo da Vinci<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;fkumro@gmail.com&gt;<br>To: nflug@nflug.org<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'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 ymailto="mailto:livemotion@gmail.com" href="mailto:livemotion@gmail.com">livemotion@gmail.com</a>&gt; 
wrote:<br>&gt; 
Hi, 
I'm 
wondering 
which 
would 
provide 
faster 
processing 
time 
based&nbsp; <br>&gt; 
on 
the 
web 
page 
I'm 
building.<br>&gt;<br>&gt; 

have 

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

to 
80.&nbsp; 
Based 
on 
$num'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'm 
guessing&nbsp; <br>&gt; 
that 
this 
could 
be 

potential 
bottleneck.&nbsp; 

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

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

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

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

"nested 
if" 
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: 
"They 
that 
can 
give 
up 
essential 
liberty 
to&nbsp; <br>&gt; 
obtain 

little 
temporary 
safety 
deserve 
neither 
liberty 
nor 
safety."<br>&gt; 
_______________________________________________<br>&gt; 
nflug 
mailing 
list<br>&gt; 
<a ymailto="mailto:nflug@nflug.org" href="mailto:nflug@nflug.org">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 ymailto="mailto:nflug@nflug.org" href="mailto:nflug@nflug.org">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 ymailto="mailto:nflug@nflug.org" 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></div><br></div></div><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"> 
Find them fast with Yahoo! Search.</a></body></html>