Re: test variable value?

From: Date: Wed, 11 Jan 2006 10:04:35 +0000
Subject: Re: test variable value?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228459@lists.php.net to get a copy of this message
William Stokes wrote:
Hello What is the best way to determine if a variable has no value? if ($var== '') or if ($var== 'null') Can 'null' be used here?
yeah buts its a string which doesn't do what you want. if (empty($var)) { echo 'yes'; } or: if (is_null($var)) { echo 'yes'; }
Thanks -Willa


« previous php.general (#228459) next »