|
Posted by Christoph Burschka on 12/08/06 13:15
Jerim79 schrieb:
> if ($Zip="")
Firstly, you need == there. The way it's now, the if statement will
/set/ $zip to "".
Secondly, PHP has "weak types". This means that any variable can be used
like a string, a number or a boolean, etc.
Therefore, this works:
if (!$zip) {
echo "zip is either '', 0, false or not set at all.";
}
Note that if PHP is set to display "notice"-level errors, it will
generate a warning if $zip was never set. You can avoid this by first
checking if $zip was ever defined:
if (!isset($zip) || !$zip) {
echo "zip is missing";
}
--
CB
Navigation:
[Reply to this message]
|