由于每个()循环从PHP 7.2开始不推荐使用,如何在没有$ value的情况下更新下面的while((= = each())循环?
如果没有$ value,我就无法使foreach循环工作.另外,while($ products_id = $ this-> contents)导致无限循环.
谢谢!
$total_items = 0;
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$total_items += $this->get_quantity($products_id);
}
Run Code Online (Sandbox Code Playgroud)