时间:2021-07-01 10:21:17 帮助过:4人阅读
$arr=array(
'listid' => array('', 5),
'title' => array('', 38),
'type' => array('', '我有'),
'count' => array('', 3),
'content' => array('无','无'),
);
$t = call_user_func_array('array_map', array_merge(array(null), $arr));
foreach($t as $k=>$v) if(array_diff($v, array('')) != $v) unset($t[$k]);
$t = count($t) == 1 ? array_chunk(current($t), 1) : call_user_func_array('array_map', array_merge(array(null), $t));
print_r(array_combine(array_keys($arr), $t));
Array
(
[listid] => Array
(
[0] => 5
)
[title] => Array
(
[0] => 38
)
[type] => Array
(
[0] => 我有
)
[count] => Array
(
[0] => 3
)
[content] => Array
(
[0] => 无
)
)