Tags
Asked 2 years ago
13 Jul 2021
Views 223
Darron

Darron posted

IS NULL empty PHP ?

IS NULL empty PHP ?
chirag

chirag
answered Aug 20 '21 00:00

NULL and empty are both not same

null is not equal to '' or '' empty in PHP

$nulltest='';
if($nulltest==null){
	echo "i am null";
} 


it will print "i am null"
but it is not empty string and null is same
lets check value and type with === ,


$emptytest='';
if($emptytest===null){
	echo "i am null";
}
 

now with checking with ===, it shows nothing, because empty string and null is not the same
Post Answer