$a=array(0=>array("name"=>"a","mail"=>"b"),1=>array("name"=>"d","mail"=>"e"))
怎样可以变成array(0=>array("name"=>"a","mail"=>"b",tel=>"k"),1=>array("name"=>"d","mail"=>"e" tel=>"e"))
方法$a=array(0=>array("name"=>"a","mail"=>"b"),1=>array("name"=>"d","mail"=>"e"));
function addkey(&$val, $key, $param)
{
$val[$param['key']] = $param['val'];
}
array_walk($a,'addkey',array('key'=>'tel', 'val'=>'123'));
print_r($a);