php7.2报错The each() function is deprecated. This message will be suppressed on furthe

php7.2版本将each()方法废除了,项目中使用到each()的地方会有如下报错

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in xxx/shop/alipay/alipay_core.function.php on line 55

解决方案也简单,可对应的将 each() 替换为 foreach(),我们看个例子,如下代码是报错行:

while (list($key, $val) = each($para)) {  }

修改如下:

foreach ($para as $key => $val) {  }