Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync unset #832

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions reference/var/functions/unset.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 52bd05eb26b2851eb4ae34b12607582d56a33897 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<!-- EN-Revision: 9f30ccc6aa0dabe411c52305202fe85209ddc06b Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.unset" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>unset</refname>
Expand Down Expand Up @@ -187,10 +187,10 @@ Before unset: 3, after unset: 23
<![CDATA[
<?php
// 销毁单个变量
unset ($foo);
unset($foo);

// 销毁单个数组元素
unset ($bar['quux']);
unset($bar['quux']);

// 销毁一个以上的变量
unset($foo1, $foo2, $foo3);
Expand All @@ -202,9 +202,9 @@ unset($foo1, $foo2, $foo3);
<title>使用 <literal>(unset)</literal> 类型强制转换</title>
<para>
<link linkend="language.types.null.casting"><literal>(unset)</literal></link>
类型强制转换常常和函数 <function>unset</function> 引起困惑。为了完整性,<literal>(unset)</literal>
是作为 <literal>NULL</literal> 类型的强制转换。它不会改变变量的类型。自
PHP 7.2.0 起,弃用 (unset) 强制转换,自 8.0.0 起移除。
类型强制转换经常与函数 <function>unset</function> 引起困惑。
为了完整性,<literal>(unset)</literal> 是作为 <literal>NULL</literal> 类型的强制转换。
它不会改变变量的类型。自 PHP 7.2.0 起,弃用 (unset) 强制转换,自 8.0.0 起移除。
</para>
<programlisting role="php">
<![CDATA[
Expand Down Expand Up @@ -232,7 +232,11 @@ string(6) "Felipe"
&note.language-construct;
<note>
<para>
It is possible to unset even object properties visible in current context.
它可以取消设置当前上下文中可见的对象属性。
</para>
<para>
如果已声明,则在访问未设置的属性时调用 <link linkend="object.get">__get()</link>,
在设置未设置的属性时调用 <link linkend="object.set">__set()</link>。
</para>
</note>
<note>
Expand All @@ -243,7 +247,7 @@ string(6) "Felipe"
<note>
<para>
在 <function>unset</function> 一个无法访问的对象属性时,如果定义了
<link linkend="object.unset">__unset()</link> 则对调用这个重载方法
<link linkend="object.unset">__unset()</link> 则会调用这个重载方法
</para>
</note>
</refsect1>
Expand Down