I'm new to PHP and unfamiliar with the !==
and ===
operators. Are Logic #1 and #2 below equivalent? And if not, why so? Basically, the code reads values from a csv row in a file, and if the value is empty it disregards empty or null values
//Logic #1
$value = readValue();
//skip empty values
if ( !$value || $value === '') {
print "empty value found";
}else{
doSomething();
}
//Logic #2
$value = readValue();
if ( $value && $value !== '' ) {
doSomething();
}else{ //skip empty values
print "empty value found";
}