note 24493 deleted from function.is-null by danbrown
| From: | danbrown@php.net | Date: | Mon, 15 Jun 2009 12:21:41 +0000 |
| Subject: | note 24493 deleted from function.is-null by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156881@lists.php.net to get a copy of this message | ||
Note Submitter: galardi at dii dot unisi dot it
----
The following function is useful for set a variable to a default value the case it contains null:
function Nz($TestVar,$ValueIfNull)
{
if (is_null($TestVar))
return $ValueIfNull;
else
return $TestVar;
}
I have used it to ensure to always write something in the cells of a table; otherwise Netscape
doesn't show the color of cell background. Ex:
<TD valign="top" BGCOLOR="#F0F0F0">
<?echo Nz($row2["Name"]," ");?>
</TD>