Jump to content
Larry Ullman's Book Forums

Recommended Posts

this is a weird error as because it was working fine before then all of the sudden I get this

 

syntax error, unexpected ',' on the line it describes it doesn't make sense the , should be there.

 

if($value1, $value2, $value3) {

 

thats where it is giving the error makes no sense...

Link to comment
Share on other sites

if () requires an expression, a list of values isn't allowed. If you are testing to see if all variables are true, you need to use a logical operator, either && (AND), or || (OR). See http://www.php.net/manual/en/control-structures.if.php

 

If you are testing to see if all the variables evaluate to true, you should use:

if ($value1 && $value2 && $value3) {

 

If you are testing to see if any of them evaluate to true, you'll want:

if ($value1 || $value2 || $value3) {

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...