With the code here there is no value assigned to $txt so there is no match in ther switch statement as it does not have a default outcome. As a rule of thumb ALWAYs have a default clause in a swtich statement. Saves a ny a mount of confusion when things don't work. Try the follwing:
function switchfntxt($txt)
{
switch($txt)
{
case "foo":
echo "bar";
break;
case "bar"
echo "foo";
break;
}
}
switchfntxt('foo');