<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>NULL</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.types.resource.html">Resources</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.types.callable.html">Callbacks</a></div> <div class="up"><a href="language.types.html">Types</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="language.types.null" class="sect1"> <h2 class="title">NULL</h2> <p class="para"> The special <strong><code>NULL</code></strong> value represents a variable with no value. <strong><code>NULL</code></strong> is the only possible value of type <span class="type"><a href="language.types.null.html" class="type null">null</a></span>. </p> <p class="para"> A variable is considered to be <span class="type"><a href="language.types.null.html" class="type null">null</a></span> if: </p> <ul class="itemizedlist"> <li class="listitem"> <p class="para"> it has been assigned the constant <strong><code>NULL</code></strong>. </p> </li> <li class="listitem"> <p class="para"> it has not been set to any value yet. </p> </li> <li class="listitem"> <p class="para"> it has been <span class="function"><a href="function.unset.html" class="function">unset()</a></span>. </p> </li> </ul> <div class="sect2" id="language.types.null.syntax"> <h3 class="title">Syntax</h3> <p class="para"> There is only one value of type <span class="type"><a href="language.types.null.html" class="type null">null</a></span>, and that is the case-insensitive constant <strong><code>NULL</code></strong>. </p> <div class="informalexample"> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$var </span><span style="color: #007700">= </span><span style="color: #0000BB">NULL</span><span style="color: #007700">; <br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> <p class="para"> See also the functions <span class="function"><a href="function.is-null.html" class="function">is_null()</a></span> and <span class="function"><a href="function.unset.html" class="function">unset()</a></span>. </p> </div> <div class="sect2" id="language.types.null.casting"> <h3 class="title">Casting to <strong><code>NULL</code></strong></h3> <p class="para"> Casting a variable to <span class="type"><a href="language.types.null.html" class="type null">null</a></span> using <em>(unset) $var</em> will <em class="emphasis">not</em> remove the variable or unset its value. It will only return a <strong><code>NULL</code></strong> value. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.types.resource.html">Resources</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.types.callable.html">Callbacks</a></div> <div class="up"><a href="language.types.html">Types</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>