php 数组NULL元素的批量处理

 $a = array('a'=>1, 'b'=>0, 'c'=>NULL);
 foreach($a as $k=>$v) {
  // if( is_null($a[$k]))
  // $a[$k] ='';
 is_null($a[$k]) ? $a[$k] = 'A': $a[$k] = 'B';
 }
 
 print_r($a);

原文地址:https://www.cnblogs.com/xihong2014/p/5361228.html