我需要将这个多维数组转换为一个简单的数组。
Array
(
[0] => Array
(
[id_zub] => 1
[name] => Backen
)
[1] => Array
(
[id_zub] => 2
[name] => Kochen
)
)
一个简单的数组:
array(
[id_zub] => 1
[name] => Backen
[id_zub] => 2
[name] => Kochen
)
函数 array_flattern($array){
foreach($array as $key=> $value){
if(is_array($value)){
$this->array_flattern($value);
}
else{
$this->result[$key] = $value;
}
}
}
该函数给了我这个结果:
Array
(
[id_zub] => 2
[name] => Kochen
)