PHP 将二维数组转成一维数组 键名保持不变 并且去掉空元素
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->array( 0=>array( 'zhangsan' => 'zhangsan (dae) abc' ) 1=>array( 'lisi' => 'lisi (dae) abc' ) 2=>array())转成array( 'zhangsan' => 'zhangsan (dae) abc', 'lisi' => 'lisi (dae) abc',)
$a = array( 0=>array( 'zhangsan' => 'zhangsan (dae) abc' ), 1=>array( 'lisi' => 'lisi (dae) abc' ), 2=>array());$list = array();foreach ($a as $v) { if (!$v) { continue; } $list[key($v)] = $v[key($v)];}<div class="clear"> </div>