PHP-取消设置对象数组会取消设置数组还是所有对象?
作者:互联网
我有一个对象数组.如果我调用unset($array),它将取消设置数组AND数组还是仅取消设置数组中的所有对象?假设这些对象在其他地方均未引用.
解决方法:
如果该数组包含对该对象的唯一引用,则为是.否则没有.另外,PHP文档中要记住以下几点:
unset() does just what it’s name says
– unset a variable. It does not force immediate memory freeing. PHP’s
garbage collector will do it when it
see fits – by intention as soon, as
those CPU cycles aren’t needed anyway,
or as late as before the script would
run out of memory, whatever occurs
first.
标签:memory-management,php 来源: https://codeday.me/bug/20191210/2100862.html