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;
}

 

展开阅读全文

没有更多推荐了,返回首页