Re: Determine whether $_GET has a value

From: Date: Thu, 24 Jun 2004 15:15:42 +0000
Subject: Re: Determine whether $_GET has a value
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-188963@lists.php.net to get a copy of this message
Terence wrote:
Hi, Say you have a querystring - index.php?myname=joe To determine whether myname has a value I have come to the following conclusions / shortcomings when using one of the following: ISSET = as long as the variable myname exists it's set, but there's no guarantee of a value !EMPTY = if your name = 0 (zero) then it's considered empty, for all else it seems to work STRLEN = I have found this to be the only sure way to know. Is there any other way, or should we always use a combination of ISSET and STRLEN?
Wouldn't this work? if(isset($_GET['var']) && !empty($_GET['var'])){
     // do something...
} Cristian

« previous php.general (#188963) next »