Data Types In Php 7 Objects Arrays Null Resource Lesson 11

Subscribe

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.

null is nothing in PHP7

Data Types In Php 7 Objects Arrays Null Resource Lesson 11 was last modified: October 29th, 2021 by Maximus Mccullough

DATA TYPES IN PHP7 HOW THEY ARE USED

Pages:Previous 1 2 3 4 Next

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.