jeroen Wed May 16 08:29:04 2001 EDT
Modified files:
/phpdoc/en/functions var.xml
Log:
- empty clarified, noted it is a language construct
Index: phpdoc/en/functions/var.xml
diff -u phpdoc/en/functions/var.xml:1.44 phpdoc/en/functions/var.xml:1.45
--- phpdoc/en/functions/var.xml:1.44 Mon May 7 06:10:13 2001
+++ phpdoc/en/functions/var.xml Wed May 16 08:29:04 2001
@@ -48,13 +48,26 @@
<title>Description</title>
<funcsynopsis>
<funcprototype>
- <funcdef>int <function>empty</function></funcdef>
+ <funcdef>boolean <function>empty</function></funcdef>
<paramdef>mixed <parameter>var</parameter></paramdef>
</funcprototype>
</funcsynopsis>
+ <note>
+ <para>
+ <function>empty</function> is a language construct.
+ </para>
+ </note>
<para>
- Returns false if <parameter>var</parameter> is set and has a
- non-empty or non-zero value; true otherwise.
+ This is the opposite of
+ <literal>(boolean) <parameter>var</parameter></literal>,
+ exept that no warning is generated when the variable is not set.
+ See <link linkend="language.types.boolean.casting">converting
+ to boolean</link> for more information.
+ </para>
+
+ <!-- Returns false if <parameter>var</parameter> is set and has a
+ non-empty or non-zero value; true otherwise. -->
+
<informalexample>
<programlisting role="php">
$var = 0;
@@ -68,12 +81,13 @@
}
</programlisting>
</informalexample>
- </para>
+
<simpara>
Note that this is meaningless when used on anything which isn't a
variable; i.e. <command>empty (addslashes ($name))</command> has
no meaning since it would be checking whether something which
isn't a variable is a variable with a false value.
+ <!-- will even result in parse error (at least in PHP 4) -->
</simpara>
<simpara>
See also <function>isset</function> and
@@ -103,7 +117,7 @@
Possibles values for the returned string are:
<itemizedlist>
<listitem>
- <simpara>"boolean"</simpara>
+ <simpara>"boolean" (since PHP 4)</simpara>
</listitem>
<listitem>
<simpara>"integer"</simpara>
@@ -120,14 +134,17 @@
<listitem>
<simpara>"object"</simpara>
</listitem>
+ <listitem>
+ <simpara>"resource" (since PHP 4)</simpara>
+ </listitem>
<listitem>
- <simpara>"resource"</simpara>
+ <simpara>"NULL" (since PHP 4)</simpara>
</listitem>
<listitem>
<simpara>"user function" (PHP 3 only, deprecated)</simpara>
</listitem>
<listitem>
- <simpara>"unknown type"</simpara>
+ <simpara>"unknown type"<!-- someone's joking? --></simpara>
</listitem>
</itemizedlist>
</para>