PHP NULL

NULL is PHP data type which returns no value.

We can initialize variable with NULL value in php.

NULL is equal to zero. So variable assigned with null returns 0 value.

Syntax:

<?php

$variable= NULL;

?>

NULL value is case-insensitive. So we can use null value for variable.

Look at below example. We have assigned value for $color variable is null. echo displays no value for $color variable.

Example :

<?php
$color=null;
echo "<br/>Color value is ".$color;
?>


<?
//We are checking that NULL is equal to zero.;
if(NULL==0)
{
echo "<br/>It is true that null is zero in php.";
}
?>

Output :

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

89542