A switch is the most efficient method. I&#39;m not sure how much speed performance is affected, but nested ifs would make the code difficult to read.<br><br>-- <br>Timothy J. Finucane<br><br><a href="http://www.speljamr.com">http://www.speljamr.com</a><br>
<br>Facebook: <a href="http://www.facebook.com/p/Timothy_J_Finucane/682422189">http://www.facebook.com/p/Timothy_J_Finucane/682422189</a><br><br><br><br><div><span class="gmail_quote">On 2/21/08, <b class="gmail_sendername">Rob Dege</b> &lt;<a href="mailto:livemotion@gmail.com">livemotion@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Hi, I&#39;m wondering which would provide faster processing time based on the web page I&#39;m building.<br><br>I have a variable, let&#39;s call it $num.&nbsp; $num is an int that can be anywhere from 1 to 80.&nbsp; Based on $num&#39;s value, an array is assigned that is then used on the web page.&nbsp; Since this is for a web page, I want to minimize the wait time as much as possible, and I&#39;m guessing that this could be a potential bottleneck.&nbsp; I have not written the code yet, so I can&#39;t compare load times.&nbsp; I&#39;m considering this more of a &quot;do it the preferred way the first time&quot;.<br>

<br>So I&#39;m curious as to which would be faster, a simple switch with 80 possible cases, or a &quot;nested if&quot; that uses a sorting algorithm;&nbsp; or perhaps even more plausible, a combination of the two.<br><br>Any random thoughts are appreciated :)<br clear="all">
<span class="sg">
<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;
</span><br>_______________________________________________<br>
nflug mailing list<br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:nflug@nflug.org">nflug@nflug.org</a><br>
<a onclick="return top.js.OpenExtLink(window,event,this)" 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>