PHP and empty() if form value is 0

From: Date: Sun, 05 Jan 2003 00:26:02 +0000
Subject: PHP and empty() if form value is 0
Groups: php.general 
Request: Send a blank email to php-general+get-130272@lists.php.net to get a copy of this message
foreach ($HTTP_GET_VARS as $key => $val) { if (!empty($HTTP_GET_VARS["$key"])) ${"$key"} = $HTTP_GET_VARS["$key"]; } foreach ($HTTP_POST_VARS as $key => $val) { if (!empty($HTTP_POST_VARS["$key"])) ${"$key"} = $HTTP_POST_VARS["$key"]; } Whenever the form variable is equal to 0, the value is not passed into the corresponding variable. For example, if isLogin = 1, then $isLogin = 1 But if isRegistered = 0 then $isRegistered = {null} I do not understand why this happens, someone enlighten me! Phil

« previous php.general (#130272) next »