Switch to or not?

From: Samuël van Laere (fortjeREM_at_chello.nl)
Date: 11/30/04


Date: Tue, 30 Nov 2004 19:04:11 GMT

Ok below you'll see two snippets that will do the same.
Is there any reason to pick one over the other?
If so what would be the reason?

Regards,
Samuël van Laere
the Netherlands

    if ($pathinfo[1] == 'pagina') {
        $query = "SELECT inhoud, titel FROM documenten WHERE id = $id";
    }
        if ($pathinfo[1] == 'artikel') {
            $query = "SELECT inhoud, titel FROM artikel WHERE id = $id";
    }else {
            $query = "SELECT inhoud, titel FROM documenten WHERE id = 1";
    }

        switch ($pathinfo[1]) {
       case 'pagina': $query = "SELECT inhoud, titel FROM documenten WHERE
id = $id";
        break;
       case 'artikel': $query = "SELECT inhoud, titel FROM artikel WHERE id
= $id";
        break;
       default: $query = "SELECT inhoud, titel FROM documenten WHERE id =
1";
        break;
}



Relevant Pages

  • Re: Switch to or not?
    ... Samuël van Laere wrote: ... > Ok below you'll see two snippets that will do the same. ... > Is there any reason to pick one over the other? ... I would always use a switch where possible (it's more obvious ...
    (alt.php)
  • Re: Way to Go-Delphi E Books
    ... snippets from the pdf to your code. ... This is a must for me and the reason why I don't buy printed books anymore ... (productivity loss). ...
    (borland.public.delphi.non-technical)
  • Re: Luiz Felipe Scolari
    ... Championships at club level and even more domestic titles in the ... many extraordinary players and teams have failed to do ... Any reason why you chose the last 16 years? ... As you know, the Netherlands ...
    (rec.sport.soccer)
  • Re: First S.E.X. of 2006 for me!
    ... Jessamy - joining in for the same reason ... In The Netherlands ... so much quilting to reply. ...
    (rec.crafts.textiles.quilting)
  • Re: Please Help with mmm3 - thanks!!
    ... >My reason for downloading the programme is ... >the Netherlands whose IP and details I have just sent to his ISP). ...
    (microsoft.public.security.virus)