[thelist] php SWITCH vs ELSE IF

Matt Williams maxwell.hung at gmail.com
Mon Apr 24 07:47:43 CDT 2006


http://uk.php.net/switch

On 4/24/06, Mark Mckee <lists at soddengecko.com> wrote:
> hi all
>
> I have written a short code to display a certain menu depending on which
> page it is on. the code works fine and I do get my desired results.
>
> i am using an ELSE IF statement and would like to know if this would be
> better than using a switch statement.
>
> sorry if this is a simple question but i was unable to find the answer
> with google and php websites.
>
> thanks in advance.
>
> the code:
>
> <?php
> if (is_page('miscellaneous'))
> {
>       echo $misc ;
> }
> elseif (is_page('associates'))
> {
>     echo $misc ;
> }
> elseif (is_page('downloads'))
> {
>     echo $misc ;
> }
> elseif (is_page('gallery'))
> {
>     echo $misc ;
> }
> elseif (is_page('reviews'))
> {
>     echo $misc ;
> }
> elseif (is_page('xbox'))
> {
>     echo $misc ;
> }
> elseif (is_page('moto-gp3'))
> {
>     echo $misc ;
> }
> ?>
>
> --
>
>
> Mark...
> http://www.soddengecko.com
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list