php7.2 废弃each方法php

/ / 2022-09-11   阅读:2513
php7.2 废弃each方法...
<?php
$b = array();
each($b);
 
// Deprecated:  The each() function is deprecated. This message will be suppressed on further calls

each方法替换为:

function fun_adm_each(&$array){
   $res = array();
   $key = key($array);
   if($key !== null){
       next($array); 
       $res[1] = $res['value'] = $array[$key];
       $res[0] = $res['key'] = $key;
   }else{
       $res = false;
   }
   return $res;
}

我要评论

昵称:
验证码:

最新评论

共0条 共0页 10条/页 首页 上一页 下一页 尾页
意见反馈