Use of NULL in PHP Tutorial Example

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

  1. Google Maps API Tutorial Geocoder Class Example
  2. Display Yahoo Weather RSS Feed PHP Class Example
  3. HTML Form Example in PHP
  4. PHP HTML Form select box Example
  5. Website Host PORT Information? - SERVER PORT PHP Server Variable Example
  6. Google Maps Static API PHP Class Example
  7. 20 steps to make CakePHP Blog Project
  8. 19 Examples to Learn MySQL
  9. 28 Basic Tutorials to Learn Oracle
  10. Email Address Validation PHP Regular Expression Example

2 comments:

  1. "ONE THING SHOULD BE VERY CLEAR THAT NULL IS NOT EVEN EQUAL TO NULL" - would you explain the subject matter.


    Rube

    ReplyDelete
  2. * consider $a and $b are two php variables
    * they are not set yet i.e - undefined or null
    * then $a can not equal to $b.

    hope u understand the subject matter.

    cheers

    ReplyDelete

leave your comments here..