How to use NULL in PHP tutorial example
WhatIsNull.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>what is null in php</title>
</head>
<body>
<h1>what is null in php example</h1>
<h1>Use of NULL in PHP</h1>
<?php
$null = null;
echo $null;
echo "<br>";
$null = NULL;
echo $null;
echo "<br>";
$null = "NULL and null";
echo $null;
echo "<br>";
/*
|-------------------------------------------------
| nothing has printed as desired.
| because null or NULL means nothing.
| "NULL and null" no doubt it is string.
|-------------------------------------------------
*/
/*
|-------------------------------------------------
| A variable is considered to be NULL if
| * it has been assigned the constant NULL.
| * it has not been set to any value yet.
| * it has been by unset() function
| ONE THING SHOULD BE VERY CLEAR THAT NULL IS
| NOT EVEN EQUAL TO NULL
|-------------------------------------------------
*/
?>
<h1>NULL means nothing</h1>
<h1>So nothing is Echoed</h1>
</body>
</html>
Use of NULL in PHP Tutorial Example - Result in the browser
Related Tutorial Examples
- Google Maps API Tutorial Geocoder Class Example
- Display Yahoo Weather RSS Feed PHP Class Example
- HTML Form Example in PHP
- PHP HTML Form select box Example
- Website Host PORT Information? - SERVER PORT PHP Server Variable Example
- Google Maps Static API PHP Class Example
- 20 steps to make CakePHP Blog Project
- 19 Examples to Learn MySQL
- 28 Basic Tutorials to Learn Oracle
- Email Address Validation PHP Regular Expression Example

"ONE THING SHOULD BE VERY CLEAR THAT NULL IS NOT EVEN EQUAL TO NULL" - would you explain the subject matter.
ReplyDeleteRube
* consider $a and $b are two php variables
ReplyDelete* they are not set yet i.e - undefined or null
* then $a can not equal to $b.
hope u understand the subject matter.
cheers