aidan Mon Jan 24 16:23:19 2005 EDT
Modified files:
/phpdoc/en/reference/var/functions empty.xml
Log:
Rewrite (also applied new docskel).
http://cvs.php.net/diff.php/phpdoc/en/reference/var/functions/empty.xml?r1=1.11&r2=1.12&ty=u
Index: phpdoc/en/reference/var/functions/empty.xml
diff -u phpdoc/en/reference/var/functions/empty.xml:1.11
phpdoc/en/reference/var/functions/empty.xml:1.12
--- phpdoc/en/reference/var/functions/empty.xml:1.11 Sun Jan 2 15:36:03 2005
+++ phpdoc/en/reference/var/functions/empty.xml Mon Jan 24 16:23:18 2005
@@ -1,40 +1,108 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.11 $ -->
-<!-- splitted from ./en/functions/var.xml, last change in rev 1.2 -->
- <refentry id="function.empty">
- <refnamediv>
- <refname>empty</refname>
- <refpurpose>Determine whether a variable is empty</refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <methodsynopsis>
- <type>bool</type><methodname>empty</methodname>
- <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
- </methodsynopsis>
- <para>
- <function>empty</function> returns &false; if
- <parameter>var</parameter> has a non-empty and non-zero value. In
- other words, <literal>""</literal>, <literal>0</literal>,
- <literal>"0"</literal>, &null;, &false;, <literal>array()</literal>, and
- <literal>var $var;</literal> are all considered empty. In PHP 4 and
- earlier, objects with empty properties are considered empty. This is not
- the case in PHP 5. &true; is returned if <parameter>var</parameter> is
empty.
- </para>
- <para>
- <function>empty</function> is the opposite of
- <literal>(boolean) <parameter>var</parameter></literal>,
- except 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>
- <para>
- <example>
- <title>
- A simple <function>empty</function> / <function>isset</function>
- comparison.
- </title>
- <programlisting role="php">
+<!-- $Revision: 1.12 $ -->
+<refentry id="function.empty">
+ <refnamediv>
+ <refname>empty</refname>
+ <refpurpose>Determine whether a variable is empty</refpurpose>
+ </refnamediv>
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>bool</type><methodname>empty</methodname>
+ <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
+ </methodsynopsis>
+ <para>
+ Determine whether a variable is considered to be empty.
+ </para>
+ </refsect1>
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>var</parameter></term>
+ <listitem>
+ <para>
+ Variable to be checked
+ </para>
+ <note>
+ <para>
+ <function>empty</function> only checks variables as anything else will
+ result in a parse error. In other words, the following will not work:
+ <command>empty(trim($name))</command>.
+ </para>
+ </note>
+ <para>
+ <function>empty</function> is the opposite of
+ <literal>(boolean) <parameter>var</parameter></literal>,
+ except that no warning is generated when the variable is not set.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Returns &false; if <parameter>var</parameter> has a non-empty
+ and non-zero value.
+ </para>
+ <para>
+ The following things are considered to be empty:
+ <simplelist>
+ <member><literal>"" (an empty string)</literal></member>
+ <member><literal>0 (0 as an integer)</literal></member>
+ <member><literal>"0" (0 as a string)</literal></member>
+ <member>&null;</member>
+ <member>&false;</member>
+ <member><literal>array() (an empty array)</literal></member>
+ <member><literal>var $var; (a variable declared, but without a value in a
class)</literal></member>
+ </simplelist>
+ </para>
+ </refsect1>
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>PHP 5</entry>
+ <entry>
+ <para>
+ As of PHP 5, objects with no properties are no longer considered
empty.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>PHP 4</entry>
+ <entry>
+ <para>
+ As of PHP 4, The string value "0" is considered empty.
+ </para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>
+ A simple <function>empty</function> / <function>isset</function>
+ comparison.
+ </title>
+ <programlisting role="php">
<![CDATA[
<?php
$var = 0;
@@ -50,29 +118,28 @@
}
?>
]]>
- </programlisting>
- </example>
- </para>
-
- ¬e.language-construct;
-
- <note>
- <para>
- <function>empty</function> only checks variables as anything else will
- result in a parse error. In other words, the following will not work:
- <command>empty(addslashes($name))</command>.
- </para>
- </note>
- <simpara>
- See also <function>isset</function>,
- <function>unset</function>,
- <function>array_key_exists</function>,
- <function>count</function>,
- <function>strlen</function>, and
- <link linkend="types.comparisons">the type comparison tables</link>.
- </simpara>
- </refsect1>
- </refentry>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+ <refsect1 role="notes">
+ &reftitle.notes;
+ ¬e.language-construct;
+ </refsect1>
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>isset</function></member>
+ <member><function>unset</function></member>
+ <member><function>array_key_exists</function></member>
+ <member><function>count</function></member>
+ <member><function>strlen</function></member>
+ <member><link linkend="types.comparisons">The type comparison
tables</link></member>
+ </simplelist>
+ </para>
+ </refsect1>
+</refentry>
<!-- Keep this comment at the end of the file
Local variables: