PHP Switch not outputting.
<p>I have this code that takes the value from another variable that it gets from an XML file. This currently worked before I cleaned up the code and now I don't know why it's not working. How it's suppose to work is takes the variable and creates a color based on the value of that variable. Then I take that new variable in this case $stormScale and assign it to a CSS class to display that color for the cell like so. </p>

<pre><code>$td4Style = "{$sbrdr}; {$bbrdr}; padding: 2px 6px 6px 6px; background-color:{$stormScale};";
</code></pre>

<p>Then I take that class and use it when the table for the other data is outputted like so. </p>

<pre><code>$tData .= "  &lt;tr&gt;&lt;td style='{$td4Style}'&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;\n";
</code></pre>

<p>This switch is suppose to assign the colors based on the value but it's not working now and I am not sure why or what I am missing. </p>

<pre><code>$stormScale = '';

           switch($ef)
{
              case '0':
                    $stormScale = 'rgba(0, 255, 255, 0.2)';
                             break;
              case '1':
                    $stormScale = 'rgba(0, 0, 255, 0.1)';
                             break;
              case '2':
                    $stormScale = 'rgba(0, 255, 0, 0.2)';
                             break;
              case '3':
                    $stormScale = 'rgba(255, 255, 0, 0.1)';
                             break;
              case '4':
                    $stormScale = 'rgba(255, 153, 51, 0.2)';
                             break;
              case '5':
                    $stormScale = 'rgba(255, 0, 0, 0.2)';
                             break;

}
</code></pre>

<p>Here is the complete code. I hope I have provided enough information. What am I missing?</p>

<pre><code>&lt;?php 
#######################################################################################
#
#  GOOGLE MAPS V3 KILLER TORNADOS
#  version 1.00
#
#  This program is free and no license is required.
#  
#
#  mesquiteweather.net
#
#######################################################################################

////  SETTINGS  ////

$GKey = 'ENTER_YOUR_KEY';                    // Enter your Google Maps API Key
$GImage = 'images/watermark_MW_GMap.png';     // Path to your watermark for your Google Map

// Change colors
$bc        = 'True';     // If True cell tables will show color of EF scale, set to false to use CSS style color
$dtColor   = '#FFF';     // Ttile Color  Examples:   "#FC0"   "#FFCC00"   "white"

////  END OF SETTINGS  ////

#######################################################################################

ini_set('display_errors','1');

// overrides from the Carter Lake Settings.php file (if applicable)
global $SITE;
if(isset($SITE['cacheFileDir'])) {$cacheFileDir = $SITE['cacheFileDir']; }
if (isset($SITE['imagesDir']))   {$imagesDir = $SITE['imagesDir'];}
if(isset ($SITE['tz']))          {$ourTZ = $SITE['tz'];}
if(!function_exists('date_default_timezone_set'))
{
    putenv("TZ=" . $ourTZ);
}
else
{
    date_default_timezone_set("$ourTZ");
}

// get path info &amp; protect for cross-site scripting vulnerability
$sri = ($_SERVER['REQUEST_URI']) ? str_replace('#SA', '', htmlspecialchars(strip_tags($_SERVER['REQUEST_URI']))) : '';

//Set path to data file
$data = "http://www.spc.noaa.gov/climo/torn/xml/2013.xml";

$bbrdr = 'border-bottom:thin solid black';       // bottom
$lbrdr = 'border-left:thin solid black';         // left
$rbrdr = 'border-right:thin solid black';        // right
$tbrdr = 'border-top:thin solid black';          // top
$sbrdr = 'border-right:thin solid black; '.
         'border-left:thin solid black';         // side
$tableStyle = "width: 100%; margin:0px auto; background-color:{$bkgColor};";
$td1Style = "{$tbrdr};{$sbrdr}; padding:2px 0px 2px 6px;  background-image:url({$imagesDir}headerbgd2.gif); color:{$dtColor};";
$td2Style = "{$sbrdr}; padding:6px 0px 0px 6px; background-color:{$stormScale};";
$td3Style = "{$sbrdr}; line-height:5px; background-color:{$stormScale};";
$td4Style = "{$sbrdr}; {$bbrdr}; padding: 2px 6px 6px 6px; background-color:{$stormScale};";

//Define table to display after each storm report
$afterTable = "&lt;table style='margin-bottom: 10px;' border='0' cellpadding='0' cellspacing='0' width='100%'&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img alt='' src='images/1pixel.gif' border='0' height='7' width='7'&gt;&lt;/td&gt;&lt;td class='shadow-mid' width='100%'&gt;&lt;img alt='' src='images/1pixel.gif' border='0' height='7' width='7'&gt;&lt;/td&gt;&lt;td&gt;&lt;img alt='' src='images/1pixel.gif' border='0' height='7' width='7'&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tbody&gt;&lt;/table&gt;\n";


// Lets parse the XML feed
$xml = simplexml_load_file($data);

//Set initial output to false
    $tData = false;
foreach($xml-&gt;fatalities as $fatalities){

    $yrnum = $fatalities['yrnum'];
    $dt = $fatalities['dt'];
    $time = $fatalities['time'];
    $updateTime = DATE("g:i a", STRTOTIME($time));
    $tz = $fatalities['tz'];
    $ef = $fatalities['ef'];
    $location = $fatalities['location'];
    $state = $fatalities['st'];
    $watch = $fatalities['watch'];
    $watchn = str_replace("WT","WW","$watch");
    $deaths = $fatalities['deaths'];

  $stormScale = '';

           switch($ef)
{
              case '0':
                    $stormScale = 'rgba(0, 255, 255, 0.2)';
                             break;
              case '1':
                    $stormScale = 'rgba(0, 0, 255, 0.1)';
                             break;
              case '2':
                    $stormScale = 'rgba(0, 255, 0, 0.2)';
                             break;
              case '3':
                    $stormScale = 'rgba(255, 255, 0, 0.1)';
                             break;
              case '4':
                    $stormScale = 'rgba(255, 153, 51, 0.2)';
                             break;
              case '5':
                    $stormScale = 'rgba(255, 0, 0, 0.2)';
                             break;

}



 // construct data for table display
    $tData .= "&lt;table style='{$tableStyle}' cellpadding='0' cellspacing='0'&gt;\n";
    $tData .= "&lt;tbody&gt;\n";
    $tData .= "  &lt;tr&gt;&lt;td style='{$td1Style}'&gt;&lt;b&gt;2013 Killer Tornado #{$yrnum}&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;\n";
    $tData .= "  &lt;tr&gt;\n";
    $tData .= "    &lt;td style='{$td2Style}'&gt;Date: &lt;b&gt;{$dt}&lt;/b&gt;&amp;nbsp;&amp;nbsp; - &amp;nbsp;&amp;nbsp;&lt;/b&gt;Time: &lt;b&gt;{$updateTime}&lt;/b&gt;&amp;nbsp;&amp;nbsp; - &amp;nbsp;&amp;nbsp;&lt;/b&gt;EF: &lt;b&gt;{$ef}&lt;/b&gt;&amp;nbsp;&amp;nbsp; - &amp;nbsp;&amp;nbsp;&lt;/             b&gt;Fatalities: &lt;b&gt;{$deaths}&lt;/b&gt;&amp;nbsp;&amp;nbsp; - &amp;nbsp;&amp;nbsp;Watch Issued: {$watchn}&lt;b&gt;&lt;/a&gt;&lt;/td&gt;\n";
    $tData .= "  &lt;/tr&gt;\n";
    $tData .= "  &lt;tr&gt;&lt;td style='{$td3Style}'&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;\n";
    $tData .= "  &lt;tr&gt;&lt;td style='{$td4Style}'&gt;County: &lt;b&gt;{$location}&lt;/b&gt;&amp;nbsp;&amp;nbsp; - &amp;nbsp;&amp;nbsp;State: &lt;b&gt;{$state}&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;\n";
    $tData .= "&lt;/tbody&gt;\n";
    $tData .= "&lt;/table&gt;\n";
    $tData .=  $afterTable;

 }  

?&gt;

&lt;?php print $tData ?&gt;
</code></pre>

<p>-Thanks</p>
