MOZ
MOZ

Reputation: 758

Multiple Conditions not working in "if"

I am using multiple conditions in if, please see the code below;

if (strpos(serialize($row['pirority']),"P1")!==false &&
    strpos(serialize($row['product']),"WFS")!==false) 
    { $wfsp1++; }

If i add another condition it doesn't work;

if (strpos(serialize($row['pirority']),"P1")!==false &&
    strpos(serialize($row['product']),"WFS")!==false) ||
    strpos(serialize($row['product']),"DayEnd")!==false) 
    { $wfsp1++; }

Can any one please guide me, what could be the reason?

Upvotes: 1

Views: 101

Answers (1)

Chetan Gawai
Chetan Gawai

Reputation: 2401

You have syntax error.Try this

if (strpos(serialize($row['pirority']),"P1")!==false &&
    strpos(serialize($row['product']),"WFS")!==false ||   //extra parenthesis was given
    strpos(serialize($row['product']),"DayEnd")!==false) 
    { $wfsp1++; }

Upvotes: 3

Related Questions