My problem can be boiled down to a snippet to see if text in $foo matches any of 3 other text items.
Here 'tis
Code:
<?
$foo = "a";
/* I want to find out if $foo matches any of 3 characters */
if ($foo == "x" || "y" || "z")
{
echo "if this prints something must be wrong";
}
echo "<br>end test";
?>
Thanks NullPointer. Your "in_array" suggestion works and solved my problem.
But your explanation, citing this code as the correct way to use the "if" statement with multiple terms still did not work for me.
Code:
<?
$foo = 'a';
if($foo == 'x' || $foo == 'y' || $foo = 'z')
{
echo "if this prints something must be wrong";
}
?>
Typo on my part. The last condition should be:
$foo == 'z'
Within the context of an conditional, an assignment returns the value being assigned. So $foo = 'z' while technically legal, is the same as 'z'. Had this been java the complier would have pointed this out.