I am explaining you, how to check if a variable is null or not in PHP. I will check null values through is_null() function in PHP.
Example :
<?php
$nullvar = NULL;
$notnull='Webdeveloperindia.in';
if(is_null($nullvar)){
echo '$nullvar is null.';
}
echo '<br />';
if(is_null($notnull)){
echo $notnull.' is null.';
}else
{
echo $notnull.' is not null.';
}
?>
Output :
$nullvar is null.
Webdeveloperindia.in is not null.
Hello, Welcome to webdeveloperindia.in. I am a full-stack web developer. Email – [email protected] | Skype – azaruddin23. I have knowledge of PHP, Laravel, Magento 1/2, Codeigniter, WordPress, Joomla, Shopify, Git, Bitbuket, jQuery, Ajax, Javascript and ReactJS.