views:

55

answers:

2

I'm stuck. I just want a simple OR inside an if condition and php always raises an error:

My Code:

if( ($value > 0.01 || $seconds < 100) ):

Error:

Parse error: syntax error, unexpected T_VARIABLE
+1  A: 

You need to provide more code, The following code works at my computer:

<?php
$value = 2;
$seconds = 10;
if( ($value > 0.01 || $seconds < 100) ) {
  echo("OK");
} else {
  echo("fail");
}
?>
Daniel Persson
A: 

Unexpected parser token errors usually indicate you have a syntax or nesting error somewhere at or before the given line, so make sure you check your previous lines too. You might just be missing a semicolon or closing bracket somewhere.

Gordon