PHP NULL Value

Rumman Ansari   Software Engineer   2020-02-01   5473 Share
☰ Table of Contents

Table of Content:


Null is a special data type which can have only one value: NULL.

A variable of data type NULL is a variable that has no value assigned to it.

Tip: If a variable is created without a value, it is automatically assigned a value of NULL.

Variables can also be emptied by setting the value to NULL:

Syntax:



<?php
$x = "Hello world!";
$x = null;
var_dump($x);
?>