cvs: phpdoc-zh /reference/var/functions isset.xml
| From: | Krazy Nio | Date: | Thu, 29 May 2003 12:51:37 +0000 |
| Subject: | cvs: phpdoc-zh /reference/var/functions isset.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1491@lists.php.net to get a copy of this message | ||
nio Thu May 29 08:51:37 2003 EDT
Added files:
/phpdoc-zh/reference/var/functions isset.xml
Log:
Add file
Index: phpdoc-zh/reference/var/functions/isset.xml
+++ phpdoc-zh/reference/var/functions/isset.xml
<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: nio $ -->
<!-- EN-Revision: 1.7 Maintainer: nio Status: ready -->
<!-- splitted from ./en/functions/var.xml, last change in rev 1.2 -->
<refentry id="function.isset">
<refnamediv>
<refname>isset</refname>
<refpurpose>¼ì²â±äÁ¿ÊÇ·ñÉèÖÃ</refpurpose>
</refnamediv>
<refsect1>
<title>ÃèÊö</title>
<methodsynopsis>
<type>bool</type><methodname>isset</methodname>
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
<methodparam
choice="opt"><type>mixed</type><parameter>var</parameter></methodparam>
<methodparam
choice="opt"><parameter>...</parameter></methodparam>
</methodsynopsis>
<note>
<para>
<function>isset</function> ÊÇÓïÑԽṹµÄÒ»²¿·Ö¡£
</para>
</note>
<simpara>
Èç¹û <parameter>var</parameter> ´æÔÚÔò·µ»Ø
&true;£¬·ñÔò·µ»Ø &false;¡£
</simpara>
<para>
Èç¹ûÒѾʹÓà <function>unset</function>
ÊÍ·ÅÁËÒ»¸ö±äÁ¿Ö®ºó£¬Ëü½«²»ÔÙÊÇ
<function>isset</function>¡£ÈôʹÓà <function>isset</function>
²âÊÔÒ»¸ö±»ÉèÖÃ³É &null; µÄ±äÁ¿£¬½«·µ»Ø
&false;¡£Í¬Ê±Òª×¢ÒâµÄÊÇÒ»¸ö &null;
×Ö½Ú£¨<literal>"\0"</literal>£©²¢²»µÈͬÓÚ
PHP µÄ &null; ³£Êý¡£
</para>
<note>
<title>¾¯¸æ</title>
<para>
<function>isset</function>
Ö»ÄÜÓÃÓÚ±äÁ¿£¬ÒòΪ´«µÝÈÎºÎÆäËü²ÎÊý¶¼½«Ôì³É½âÎö´íÎó¡£ÈôÏë¼ì²â<link
linkend="language.constants">³£Á¿</link>ÊÇ·ñÒÑÉèÖ㬿ÉʹÓÃ
<function>defined</function> º¯Êý¡£
</para>
</note>
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$var = '';
// ½á¹ûΪ TRUE£¬ËùÒÔºó±ßµÄÎı¾½«±»´òÓ¡³öÀ´¡£
if (isset($var)) {
print "This var is set set so I will print.";
}
// ÔÚºó±ßµÄÀý×ÓÖУ¬ÎÒÃǽ«Ê¹Óà var_dump Êä³ö isset()
µÄ·µ»ØÖµ¡£
$a = "test";
$b = "anothertest";
var_dump( isset($a) ); // TRUE
var_dump( isset ($a, $b) ); // TRUE
unset ($a);
var_dump( isset ($a) ); // FALSE
var_dump( isset ($a, $b) ); // FALSE
$foo = NULL;
var_dump( isset ($foo) ); // FALSE
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
Õâ¶ÔÓÚÊý×éÖеÄÔªËØÒ²Í¬ÑùÓÐЧ£º
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$a = array ('test' => 1, 'hello' => NULL);
var_dump( isset ($a['test']) ); // TRUE
var_dump( isset ($a['foo']) ); // FALSE
var_dump( isset ($a['hello']) ); // FALSE
// ¼ü 'hello' µÄÖµµÈÓÚ NULL£¬ËùÒÔ±»ÈÏΪÊÇδÖÃÖµµÄ¡£
// Èç¹ûÏë¼ì²â NULL ¼üÖµ£¬¿ÉÒÔÊÔÊÔϱߵķ½·¨¡£
var_dump( array_key_exists('hello', $a) ); // TRUE
?>
]]>
</programlisting>
</informalexample>
</para>
<simpara>
²Î¼û
<function>empty</function>¡¢<function>unset</function>¡¢<function>defined</function>¡¢<function>array_key_exists</function>
ºÍ´íÎó¿ØÖÆ
<link linkend="language.operators.errorcontrol">@</link>
ÔËËã·û¡£
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->