FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » switch says value is equal to case when it is not
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: switch says value is equal to case when it is not [message #184682 is a reply to message #184666] Wed, 15 January 2014 17:32 Go to previous messageGo to previous message
frank.catry is currently offline  frank.catry
Messages: 9
Registered: October 2013
Karma:
Junior Member
between every CASE you need BREAK;



Op dinsdag 14 januari 2014 20:54:40 UTC+1 schreef richard:
> <?php
>
>
>
> $go=$_GET['a'];
>
> if(empty($go)){$go="home";}
>
>
>
> if ($go==2){include "http://mroldies.net/radio/24hours.php";}
>
> if ($go==1){include"http://mroldies.net/test/index2.php";}
>
> if ($go=="home"){include "http://mroldies.net/home1.php";}
>
>
>
> switch ($go) {
>
>
>
> case 60 || 61 || 62 || 63 || 64 || 65 || 66 || 67 || 68 || 69:
>
> include "http://mroldies.net/songs/19".$go.".html";
>
>
>
> case "A" || "B" || "C" || "D" || "E" || "F" || "G" || "H" || "I" || "J" ||
>
> "K" || "L":
>
> include "http://mroldies.net/songs/".$go.".html";
>
>
>
> case "M" || "N" || "O" || "P" || "Q" || "R" || "S" || "T" || "U" || "V" ||
>
> "W" || "X" || "Y" || "Z":
>
> include "http://mroldies.net/songs/".$go.".html";
>
>
>
> }
>
>
>
>
>
> ?>
>
>
>
> "home" is matched in every case.
>
> Why?
>
>
>
> "Case" is not conditional.
>
> There must be an EXACT match or false is returned.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: php.ini loading
Next Topic: How to locally install Wordpress, Ubuntu 8.10 , XAMPP already installed.
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 00:27:38 GMT 2024

Total time taken to generate the page: 0.03368 seconds