Array(
[0] => Array(
[0] => My Property
[1] => Array(
[0] => Tiles Market
[1] => My Floor
)
)
)
和
array([0]=>My Property [1] => Tiles Market [2] => My Floor)
$arr = array(); // Your array content
$merged_array = array();
$ri = new RecursiveIteratorIterator(new RecursiveArrayIterator($arr));
foreach($ri as $r) {
array_push($merged_array,$r);
}
echo "<pre>"; print_r($merged_array);
try this
$new_array = call_user_func_array('array_merge', $old_array);
Demo
你可以像下面这样使用RecursiveArrayIterator;
<?php
function MultiToOne($from, &$to) {
$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($from));
foreach($it as $k => $v) {
$to[] = $v;
}
}
$arr = array(
"0" => array(
"0" => "My Property",
"1" => array(
"0" => "Tiles Market",
"1" => "My Floor"
)
)
);
$myFinalArr = array();
MultiToOne($arr, $myFinalArr);
var_dump($myFinalArr);
?>