> This doesnt work as expected. > > if ( $var === "TEST ONE" || "TEST TWO" || "TEST THREE") { > > do something; > > } > > It returns true on all strings. Ive tried using the or operator > and the == but these fail as well. Any Ideas?
It behaves exactly as expected. Try checking the manual section on control structures, I believe it explains that the syntax you are using is invalid. What you are saying is if ( $var === ("TEST ONE" || "TEST TWO" || "TEST THREE")) { ("TEST ONE" || "TEST TWO" || "TEST THREE") is always going to evaluate as true. I think what you want is if ( $var === "TEST ONE" || $var === "TEST TWO" || $var === "TEST THREE") { -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php