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

123 views Asked by At

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']){
}
1

There are 1 answers

2
Ritesh Khatri On

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.