Saturday, 15 June 2013

html - Php syntax ( if or ) -



html - Php syntax ( if or ) -

sorry can't test myself! correct?

if ($var1 == "example" or $var2 == "example2") { }

or

if (($var1 == 1) or ($var2 == 2))

thanks (sorry mistakes, italian).

the syntax right , both version equivalent in terms of logic.

i write this:

if ($var1 == "example" || $var2 == "example") { ... }

although or perfectly valid:

if ($var1 == "example" or $var2 == "example") { ... }

you asking if needed enclose in parenthesis. not, while can useful if status grows plenty create hard understand when 1 starts , other begins.

php html css sql syntax

No comments:

Post a Comment