-2

Looking for a bit of PHP help here please..

I am looking to check to see if the contents of a few variables match defined criteria, and if so, to set the value of an additional variable accordingly.

So, I was thinking the below should work... but it has syntax errors which confuse me!

if ($var1 == "chicken" || $var == "banana") { $outputVar = "fail" } else { $outputVar = "success" }

What is wrong with the above?

Thanks

dubbs
  • 1,167
  • 2
  • 13
  • 34

2 Answers2

1

You haven't put semicolons in any of your statements. It will solve your problem.

if ($var1 == "chicken" || $var == "banana") { $outputVar = "fail"; } else { $outputVar = "success"; }
Imesha Sudasingha
  • 3,462
  • 1
  • 23
  • 34
0

You are evalutaing ($var and $var1 ) this is true? ... and you don't have semicolon at the end

if ($var1 == "chicken" || $var == "banana") {
    $outputVar = "fail" ;
 } else {
   $outputVar = "success" ; 
}
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107