check whether a variable is null in PHP
In this post we will give you information about check whether a variable is null in PHP. Hear we will give you detail about check whether a variable is null in PHPAnd how to use it also give you demo for it if it is necessary.
Use the PHP is_null() function
You can use the PHP is_null() function to check whether a variable is null or not.
Let’s check out an example to understand how this function works:
<?php $var = NULL; // Testing the variables if(is_null($var)){ echo 'This line is printed, because the $var is null.'; } echo "<br>"; if(is_null($inexistent)){ echo 'This line is printed, because the $inexistent is null.'; } ?>
i hope you like this article.
Hope this and post will helped you for implement check whether a variable is null in PHP. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and Keep reading our blogs