cvs: phpdoc-zh /reference/var/functions empty.xml
| From: | Krazy Nio | Date: | Mon, 16 Jun 2003 12:53:56 +0000 |
| Subject: | cvs: phpdoc-zh /reference/var/functions empty.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1519@lists.php.net to get a copy of this message | ||
nio Mon Jun 16 08:53:56 2003 EDT
Modified files:
/phpdoc-zh/reference/var/functions empty.xml
Log:
EN 1.5
Index: phpdoc-zh/reference/var/functions/empty.xml
diff -u phpdoc-zh/reference/var/functions/empty.xml:1.3
phpdoc-zh/reference/var/functions/empty.xml:1.4
--- phpdoc-zh/reference/var/functions/empty.xml:1.3 Thu May 8 13:05:59 2003
+++ phpdoc-zh/reference/var/functions/empty.xml Mon Jun 16 08:53:55 2003
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="gb2312"?>
-<!-- $Revision: 1.3 $ -->
-<!-- $Author: dallas $ -->
-<!-- EN-Revision: 1.4 Maintainer: nio Status: ready -->
+<!-- $Revision: 1.4 $ -->
+<!-- $Author: nio $ -->
+<!-- EN-Revision: 1.5 Maintainer: nio Status: ready -->
<!-- splitted from ./en/functions/var.xml, last change in rev 1.2 -->
<refentry id="function.empty">
<refnamediv>
<refname>empty</refname>
- <refpurpose>¼ì²éÒ»¸ö±äÁ¿ÊÇ·ñÒÑÖÃÖµ</refpurpose>
+ <refpurpose>¼ì²éÒ»¸ö±äÁ¿ÊÇ·ñΪ¿Õ</refpurpose>
</refnamediv>
<refsect1>
<title>ÃèÊö</title>
@@ -14,48 +14,56 @@
<type>bool</type><methodname>empty</methodname>
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
</methodsynopsis>
- <note>
- <para>
- <function>empty</function> ÊÇÓïÑԽṹµÄÒ»²¿·Ö¡£
- </para>
- </note>
- ¬e.language-construct;
<para>
- ³ýÁ˵±±äÁ¿Ã»ÓÐÖÃֵʱ²»²úÉú¾¯¸æÖ®Í⣬ÕâÊÇ
+ Èç¹û <parameter>var</parameter> ÊǷǿջò·ÇÁãµÄÖµ£¬Ôò
+ <function>empty</function> ·µ»Ø
+
&false;¡£»»¾ä»°Ëµ£¬<literal>""</literal>¡¢<literal>0</literal>¡¢<literal>"0"</literal>¡¢&null;¡¢&false;¡¢<literal>array()</literal>¡¢<literal>var
$var;</literal>
+ ÒÔ¼°Ã»ÓÐÈκÎÊôÐԵĶÔÏó¶¼½«±»ÈÏΪÊǿյģ¬Èç¹û
+ <parameter>var</parameter> Ϊ¿Õ£¬Ôò·µ»Ø &true;¡£
+ </para>
+ <para>
+
³ýÁ˵±±äÁ¿Ã»ÓÐÖÃֵʱ²»²úÉú¾¯¸æÖ®Í⣬<function>empty</function>
ÊÇ
<literal>(boolean) <parameter>var</parameter></literal>
µÄ·´Òå´Ê¡£²Î¼û<link
linkend="language.types.boolean.casting">ת»»Îª²¼¶ûÖµ</link>»ñÈ¡¸ü¶àÐÅÏ¢¡£
</para>
-
- <!-- Returns &false; if <parameter>var</parameter> is set and has a
- non-empty or non-zero value; &true; otherwise. -->
-
- <informalexample>
+ <para>
+ <example>
+ <title>
+ <function>empty</function> Óë <function>isset</function>
+ µÄÒ»¸ö¼òµ¥±È½Ï¡£
+ </title>
<programlisting role="php">
<![CDATA[
+<?php
$var = 0;
-if (empty($var)) { // ½á¹ûΪ true
+// ½á¹ûΪ true£¬ÒòΪ $var Ϊ¿Õ
+if (empty($var)) {
echo '$var is either 0 or not set at all';
}
-if (!isset($var)) { // ½á¹ûΪ false
+// ½á¹ûΪ false£¬ÒòΪ $var ÒÑÉèÖÃ
+if (!isset($var)) {
echo '$var is not set at all';
}
+?>
]]>
</programlisting>
- </informalexample>
+ </example>
+ </para>
+ ¬e.language-construct;
+
+ <note>
+ <para>
+ <function>empty</function>
Ö»¼ì²â±äÁ¿£¬¼ì²âÈκηDZäÁ¿µÄ¶«Î÷¶¼½«µ¼Ö½âÎö´íÎó¡£»»¾ä»°Ëµ£¬ºó±ßµÄÓï¾ä½«²»»áÆð×÷Óãº
+ <command>empty(addslashes($name))</command>¡£
+ </para>
+ </note>
<simpara>
-
×¢Òâ´Ëº¯ÊýÓÃÓÚÈκηDZäÁ¿µÄ¶«Î÷¶¼ÊǺÁÎÞÒâÒåµÄ£»ÀýÈç
- <command>empty (addslashes ($name))</command>
-
¾ÍÊÇûÓÐÒâÒåµÄ£¬ÒòΪËü½«ÔÚ¼ì²é·Ç±äÁ¿µÄ¶«Î÷ÊÇ·ñÊDZäÁ¿Ê±·µ»Ø
- &false;¡£
- <!-- will even result in parse error (at least in PHP 4) -->
- </simpara>
- <simpara>
- ²Î¼û <function>isset</function> ºÍ
- <function>unset</function>¡£
- </simpara>
+ ²Î¼û
<function>isset</function>¡¢<function>unset</function>¡¢<function>array_key_exists</function>¡¢<function>count</function>
+ ºÍ <function>strlen</function>¡£
+ </simpara>
</refsect1>
</refentry>