Karan Tiwari
Karan Tiwari

Reputation: 83

I want use && operator and Not operator at the same time in IF statement

I want use && operator and Not operator at the same time in IF statement. If it is possible then how to write it. Below is the statement which i have written is it right?

if(!$row['sl_name'] && !$row['sn_name']){
}

Upvotes: -3

Views: 176

Answers (1)

Ritesh Khatri
Ritesh Khatri

Reputation: 1301

You can write like this if you wish to check for blank variables:

if(!empty($row['sl_name']) && !empty($row['sn_name'])){

}
else{
}

It checks for both the variables are not empty if anyone of them is empty it goes to else part.

Upvotes: 1

Related Questions