Tags
Asked 3 years ago
13 Jul 2021
Views 196
Arnaldo

Arnaldo posted

Is null in PHP ?

Is null in PHP ?
iptracker

iptracker
answered Aug 20 '21 00:00

yes There is null is in PHP ,
null means no value or nothing


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



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 show nothing , because empty string and null is not same



NULL is same as null in PHP

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


all above codes return the same output that "i am null" because empty and null is both equal in PHP .

Post Answer