[pmwiki-devel] Testing empty string (was:php logic question)

marc gmane at auxbuss.com
Wed Mar 14 04:58:25 CDT 2007


Hans said...
> Wednesday, March 14, 2007, 9:00:29 AM, christian wrote:
> 
> > but as it's not NULL
> 
> BTW, what is the difference between NULL and ""
> (and 0 for that matter)?

Basically,

"" is an empty string. So it has a type (it's of type string) and a 
length of zero. 

0 is of type numeric (integer, whereas 0.0 is a float)

For NULL, see the docs:

  The special NULL value represents that a variable has no value. NULL 
  is the only possible value of type NULL. 

  A variable is considered to be NULL when 
  - it has been assigned the constant NULL. 
  - it has not been set to any value yet. 
  - it has been unset(). 

  Syntax
  There is only one value of type NULL, and that is the case-insensitive 
  keyword NULL. 

  <?php $var = NULL; ?>

-- 
Cheers,
Marc




More information about the pmwiki-devel mailing list