做阵列()销毁所有previous值?

编程入门 行业动态 更新时间:2024-10-28 02:25:58
本文介绍了做阵列()销毁所有previous值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个$阵列与存储在它的一些价值观。现在,如果我做的:

I have an $array with some values stored on it. Now, if I do :

$array=array();

所有的值/索引中删除?或者,我需要在它之前使用未设置()?

all values/index are deleted? Or I need to use unset() before it?

推荐答案

一个新阵列正在与创建阵列(),这新数组对象赋给变量 $阵列。

A new array is being created with array() and this new array object is assigned to the variable $array.

变量( $阵列)不再指向的原始的数组对象 - 因为PHP是一种垃圾回收的语言 - 的的原始的数组对象将有资格回收的如果(且仅当)的不再是强可从根对象。 (实际时间previous数组对象和对象包含它在实际删除取决于其他因素。)

The variable ($array) no longer points to the original array object -- and because PHP is a garbage collected language -- the original array object will be eligible for reclamation if (and only if) it is no longer strongly reachable from a root object. (The actual time the previous array object and objects it contained are actually deleted depends on other factors.)

快乐编码。

请参阅 PHP垃圾收集手册了解更多详细信息 - PHP使用混合GC(REF-计数和周期破)。

See PHP Garbage Collection Manual for more details -- PHP uses a hybrid GC (ref-count and cycle-breaking).

更多推荐

做阵列()销毁所有previous值?

本文发布于:2023-05-26 06:16:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/252283.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:阵列   previous

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!