如何在PHP中取消设置整个数组? [英] How to unset entire array in PHP?

查看:63
本文介绍了如何在PHP中取消设置整个数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的页面上运行了47次循环。在每个循环过程中,所有错误消息都会输入到err []中并打印出来。我试图在每次迭代后清空数组,但遇到了一些麻烦。

I have a loop that runs 47 times on my page. During the course of each loop, any error messages are entered into err[] and are printed out. I'm trying to blank the array after each iteration and I'm running into some trouble.

每次迭代可能有4或5条错误消息,有时没有。除了运行另一个foreach循环并取消设置每个值之外,还有一种更简便的方法来在每次迭代后重置整个数组吗?

There could be 4 or 5 error messages per iteration, sometimes none. Is there an easier way of resetting the entire array after each iteration beyond running another foreach loop and unsetting each value? A way of clearing all contents and resetting the indexes without actually removing the array itself?

推荐答案

您应该使用:
未设置($ err);

这篇关于如何在PHP中取消设置整个数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆