Kim2
07-02-2008, 03:37 PM
Im trying to avoid writing the same things over and over again with statements. Such as replacing code example 1 with example 2, but without luck. Example 2 always return true.
I know about switch/case, but thats not want Im looking for.
Example 1
$str = "C";
if (($str == "A") || ($str == "B"))
Example 2
$str = "C";
if ($str == ("A" || "B"))
Any ideas why ?
Or how to reduce example 1 to something smaller.
I know about switch/case, but thats not want Im looking for.
Example 1
$str = "C";
if (($str == "A") || ($str == "B"))
Example 2
$str = "C";
if ($str == ("A" || "B"))
Any ideas why ?
Or how to reduce example 1 to something smaller.