Data Type NULL in PHP7
The Data Type NULL in PHP7 only holds one value and that is NULL. NULL is basically nothing, it means that nothing is in that data string. Here is an example. Let’s set the $var=’PHP7′ and then we will change the variable to NULL then echo it out on the page.
<?php $var='PHP7'; echo $var; echo '<br>'; $var=null; echo $var ?>
As you can see the variable $var was emptied and nothing is being echoed out in the second $var. If a variable is created with nothing in it is it automatically assigned NULL.
How Do We Use NULL in PHP7 Applications?
We use NULL to store nothing in a variable. However we do not put the term NULL in the variable we just leave it empty. In the future when you are working with loops you may set a variable to NULL and then fill it with some other data.
Please like, share and subscribe.
I hope you enjoyed the article. If I was able to help you please consider a tip for the content.
One Time Tip