在 foreach 循环中取消设置数组元素
我正在 foreach 循环内通过引用访问数组,但 unset() 函数似乎不起作用:
foreach ( $this->result['list'] as &$row ) {
if ($this_row_is_boring) {
unset($row);
}
}
print_r($this->result['list']); // Includes rows I thought I unset
想法?谢谢!