a missing variable in a switch statement ?!!
- by mechhfly
hi folks, i have a strange issue. a variable seems to be missing during a pass through a case statement
i have a function like so
function checklink($var0, $var1, $var2)
{
switch($var0)
{
case "case1":
print $var2;
//code uses $var2 successfully
case "case2":
print $var2;
//variable has disappeared!
}
}
essentially what i am doing is constructing a string from the last variable based on the first. if i run the code in which the first case is true, i get the expected results, but when i run the second case, my variable seems to have vanished. these first two case statements are syntactically the same and the variable is gathered from the $_GET array (hard coded into hyperlink). any light on this issue?
if more explanation is needed let me know, its late and my brain is getting mushy.
thanks my friends.