For cleared or unset php arrays, are elements garbage collected?

后端 未结 3 1523
执笔经年
执笔经年 2021-01-13 06:26

if I unset an array, would its elements be garbage collected or freed up assuming they are not referenced in anywhere else? what if I simply do $array =new array();

3条回答
  •  自闭症患者
    2021-01-13 06:35

    The following will modify the array itself and leave it empty:

    array_splice($myArray, 0);
    

    And the Splice Documentation

提交回复
热议问题