Andreas Görtz: Abfrage ist falsch?

Beitrag lesen

Hi,

empty($anzahl) -> ?! (ACHTUNG: "0" ist meines Wissens nicht das selbe wie 0, damit ist $anzahl=0 empty, $anzahl="0" aber nicht, da das ein String mit Inhalt 0 ist, aber da bin ich mir nicht ganz sicher).

das ist falsch. empty() liefert bei "0" ebenfalls true. Auszug aus http://de3.php.net/manual/en/function.empty.php:

In otherwords, "", 0, "0", NULL, FALSE, array(), var $var;, and objects with empty properties, are all considered empty.

Gruß.