> case strpos($line,"#date:") == 0 && strpos($line,"#date:") !== false:
You can just do a === 0 check here, you don't need the second check to make sure it isn't false. However, that's not really how you use a switch expression anyway. The expressions in the case statement should be constants. If you rewrite your code to look like this it will work fine: <?php // read the guestbook source file // version 1 $fp = fopen("guestbook.txt","r"); while (! feof($fp)) { $line = fgets($fp, 4096); if(substr($line,0,6)=='#date:') { $print = strtr(substr($line, 7),"\r\n"," "); $print = date("j F Y H.i.s O",strtotime(trim($print))); echo "<span class=\"ylwbld\">On $print, "; continue; } if(substr($line,0,7)=='#email:') { $emailfound = true; $print = strtr(substr($line, 8),"\r\n"," "); echo "<a href=\"mailto:".trim($print)."\" class=\"ylwlink\">"; continue; } if(substr($line,0,6)=='#name:') { $print = strtr(substr($line, 7),"\r\n"," "); echo trim($print); if ($emailfound) { echo("</a>"); } continue; } if(substr($line,0,6)=='#from:') { $print = strtr(substr($line, 6),"\r\n"," "); echo " of ".trim($print); continue; } if(substr($line,0,9)=='#message:') { $print = strtr(substr($line, 9),"\r\n"," "); echo " wrote:</span><br>\n"; echo "<span class=\"whttxt\">".trim($print)."</span><br>\n"; continue; } if(substr($line,0,6)=='#link:') { $print = strtr(substr($line, 6),"\r\n"," "); echo "<span class=\"ylwbld\">Link:</span> "; echo "<a href=\"http://".trim($print)."\" target=\"_new\" class=\"ylwlink\">".trim($print)."</a><br>\n"; continue; } if(substr($line,0,9)=='#comment:') { $print = strtr(substr($line, 9),"\r\n"," "); echo "<span class=\"redbld\">And the webmaster responded: ".trim($print)."</span><br>\n"; continue; } if(substr($line,0,3)=='#--') { $print = strtr(substr($line, 3),"\r\n"," "); echo "<hr width=\"85%\" color=\"#ffffff\" noshade align=\"center\">\n"; continue; } } fclose($fp); ?> -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php