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
switch says value is equal to case when it is not [message #184666] Tue, 14 January 2014 19:54 Go to previous message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma:
Senior Member
<?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: Sat Nov 30 20:21:17 GMT 2024

Total time taken to generate the page: 0.04275 seconds