PHP-是否可以在其他页面中继续foreach


PHP - Is it possible to continue foreach inside other page?

IIs有可能做这样的事情吗:

foreach ($var as $val){
//code here
//code to continue
}

并在其他函数中再次调用foreach:

foreach ($var as $val){
//code to continue
//loop continuation
}

您可以任意多次调用foreach。您只需要以某种方式将这个数组/对象传递给其他函数。每次调用foreach时,它都会从头开始迭代。