Separate clauses of an if statement?

Posted by tarnfeld on Stack Overflow See other posts from Stack Overflow or by tarnfeld
Published on 2010-02-01T16:31:18Z Indexed on 2010/05/09 5:08 UTC
Read the original article Hit count: 254

Filed under:
|
|

Is there any way to have multiple clauses in an if() statement?

For instance:

if( ($username=='textUser' && $role=='admin') || ($admin=='yes'))
{
    // If the username AND role are set to admin OR if the admin is set to 'yes'
}
else
{
    // Neither clauses of the if statement are true
}

Perhaps this is actually the correct code, i have no tried it - but if not, could anyone tell me how? :)

© Stack Overflow or respective owner

Related posts about php

Related posts about clause