cvs: phpdoc-zh /reference/var/functions unset.xml
| From: | Krazy Nio | Date: | Sat, 14 Jun 2003 14:11:40 +0000 |
| Subject: | cvs: phpdoc-zh /reference/var/functions unset.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1509@lists.php.net to get a copy of this message | ||
nio Sat Jun 14 10:11:40 2003 EDT
Added files:
/phpdoc-zh/reference/var/functions unset.xml
Log:
Add file
Index: phpdoc-zh/reference/var/functions/unset.xml
+++ phpdoc-zh/reference/var/functions/unset.xml
<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: nio $ -->
<!-- EN-Revision: 1.2 Maintainer: nio Status: ready -->
<!-- splitted from ./en/functions/var.xml, last change in rev 1.2 -->
<refentry id="function.unset">
<refnamediv>
<refname>unset</refname>
<refpurpose>ÊͷŸø¶¨µÄ±äÁ¿</refpurpose>
</refnamediv>
<refsect1>
<title>ÃèÊö</title>
<methodsynopsis>
<type>void</type><methodname>unset</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>unset</function> ÊÇÓïÑԽṹµÄÒ»²¿·Ö¡£
</para>
</note>
<para>
<function>unset</function> ÆÆ»µÖ¸¶¨µÄ±äÁ¿¡£×¢ÒâÔÚ
PHP 3 ÖУ¬<function>unset</function> ½«·µ»Ø
&true;£¨Êµ¼ÊÉÏÊÇÕûÐÍÖµ 1£©£¬¶øÔÚ PHP 4
ÖУ¬<function>unset</function>
²»ÔÙÊÇÒ»¸öÕæÕýµÄº¯Êý£ºËüÏÖÔÚÊÇÒ»¸öÓï¾ä¡£ÕâÑù¾ÍûÓÐÁË·µ»ØÖµ£¬ÊÔͼ»ñÈ¡
<function>unset</function> µÄ·µ»ØÖµ½«µ¼Ö½âÎö´íÎó¡£
</para>
<para>
<example>
<title><function>unset</function> ʾÀý</title>
<programlisting role="php">
<![CDATA[
// ÆÆ»µµ¥¸ö±äÁ¿
unset ($foo);
// ÆÆ»µµ¥¸öÊý×éÔªËØ
unset ($bar['quux']);
// ÆÆ»µÒ»¸öÒÔÉϵıäÁ¿
unset ($foo1, $foo2, $foo3);
]]>
</programlisting>
</example>
</para>
<para>
<function>unset</function>
ÔÚº¯ÊýÖеÄÐÐΪ»áÒÀÀµÓÚÏë񻮮»µµÄ±äÁ¿µÄÀàÐͶøÓÐËù²»Í¬¡£
</para>
<para>
Èç¹ûÔÚº¯ÊýÖÐ <function>unset</function>
Ò»¸öÈ«¾Ö±äÁ¿£¬ÔòÖ»ÊǾֲ¿±äÁ¿±»ÆÆ»µ£¬¶øÔÚµ÷Óû·¾³ÖеıäÁ¿½«±£³Öµ÷ÓÃ
<function>unset</function> ֮ǰһÑùµÄÖµ¡£
<informalexample>
<programlisting role="php">
<![CDATA[
function destroy_foo() {
global $foo;
unset($foo);
}
$foo = 'bar';
destroy_foo();
echo $foo;
]]>
</programlisting>
</informalexample>
ÉϱߵÄÀý×Ó½«Êä³ö£º
<informalexample>
<screen>
<![CDATA[
bar
]]>
</screen>
</informalexample>
</para>
<para>
Èç¹ûÔÚº¯ÊýÖÐ <function>unset</function>
Ò»¸öͨ¹ýÒýÓô«µÝµÄ±äÁ¿£¬ÔòÖ»ÊǾֲ¿±äÁ¿±»ÆÆ»µ£¬¶øÔÚµ÷Óû·¾³ÖеıäÁ¿½«±£³Öµ÷ÓÃ
<function>unset</function> ֮ǰһÑùµÄÖµ¡£
<informalexample>
<programlisting role="php">
<![CDATA[
function foo(&$bar) {
unset($bar);
$bar = "blah";
}
$bar = 'something';
echo "$bar\n";
foo($bar);
echo "$bar\n";
]]>
</programlisting>
</informalexample>
ÉϱߵÄÀý×Ó½«Êä³ö£º
<informalexample>
<screen>
<![CDATA[
something
something
]]>
</screen>
</informalexample>
</para>
<para>
Èç¹ûÔÚº¯ÊýÖÐ <function>unset</function>
Ò»¸ö¾²Ì¬±äÁ¿£¬Ôò <function>unset</function>
½«ÆÆ»µ´Ë±äÁ¿¼°ÆäËùÓеÄÒýÓá£
<informalexample>
<programlisting role="php">
<![CDATA[
function foo() {
static $a;
$a++;
echo "$a\n";
unset($a);
}
foo();
foo();
foo();
]]>
</programlisting>
</informalexample>
ÉϱߵÄÀý×Ó½«Êä³ö£º
<informalexample>
<screen>
<![CDATA[
1
2
3
]]>
</screen>
</informalexample>
</para>
<para>
Èç¹ûÄúÏëÔÚº¯ÊýÖÐ <function>unset</function>
Ò»¸öÈ«¾Ö±äÁ¿£¬¿ÉʹÓà <varname>$GLOBALS</varname>
Êý×éÀ´ÊµÏÖ£º
<informalexample>
<programlisting role="php">
<![CDATA[
function foo() {
unset($GLOBALS['bar']);
}
$bar = "something";
foo();
]]>
</programlisting>
</informalexample>
</para>
<para>
²Î¼û <function>isset</function> ºÍ
<function>empty</function>¡£
</para>
</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
-->