php tutorial - PHP Datatypes NULL - php programming - learn php - php code - php script




  • “NULL” is a special Data type that represents a variable with no value.
  • The NULL is defined as a special variable, in most of the cases it means that it is a data type which can be stated as nonexistent or not known or else empty.

php code Syntax :

<?php
    $my_var = NULL;
?>
click below button to copy the code. php tutorial - team

learn php Sample Code : a simple php program

<!DOCTYPE html>
<html>
    <head>
        <title>Datatype-NULL</title>
    </head>
    <body>
        <?php
            $x = "welcome to wikitechy world(www.wikitechy.com)";
            $x = null;
            var_dump($x);
        ?>
    </body>
</html>
click below button to copy the code. php tutorial - team

php for beginners Code Explanation :

Code Explanation for Datatype NULL In PHP

  1. In PHP, $x = “Welcome to wiitechy world (www.wikitechy.com”) variable is created that is holding the statement.
  2. Here $x = null; specifies a variable being created without a value, which will be assigned a value as “NULL”.
  3. The var_dump() function returns the null data type.

php tutorials Sample Output :

output for Datatype NULL In PHP

  1. var_dump() function returns the data type with its value as “NULL”.


Related Searches to php datatype null