Re: switch vs elseif -- switchtable
| From: | Eric Butera | Date: | Mon, 12 Jan 2009 21:05:45 +0000 |
| Subject: | Re: switch vs elseif -- switchtable | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-286149@lists.php.net to get a copy of this message | ||
On Mon, Jan 12, 2009 at 4:00 PM, Daevid Vincent <daevid@daevid.com> wrote:
> On Mon, 2009-01-12 at 15:31 -0500, Eric Butera wrote:
>
>> On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
>> <blindspotpro@comcast.net> wrote:
>> > I've googled, and found some confusing answers.
>> > I've tried searching the history of the news group, and only found info on
>> > switch or elseif seperately. :(
>> >
>> > Strictly from a performance stand point, not preference or anything else, is
>> > there a benefit of one over the other?
>> >
>> >
>> > for($i=0;$i<3;$i++){
>> > switch($i){
>> > case 0:
>> > header pg1 code
>> > break;
>> > case 1:
>> > header pg2 code
>> > break;
>> > case 3:
>> > header pg3 code
>> > break;
>> > };
>> > };
>> >
>> >
>> > or would that be better served using an if...elseif structure?
>> >
>> > Frank
>
>
>
>> This might be of interest in answering your question:
>>
>> http://www.suspekt.org/switchtable/
>
>
> How do I install this? The page and .tgz both give no instructions?!
>
> Are there any benchmarks to show speed comparisons?
>
> Also, is there any plans to have this patch/extension incorporated into
> the real PHP trunk?
>
> Daevid.
> http://daevid.com
>
Hi Daevid,
Someone wrote a quick bench on this url:
http://www.suspekt.org/2008/07/31/switch-table-extension/
As for all your other questions, you'll have to contact the author. I
just thought it applied to this thread.