"a","b"=>array("c"=>"1","d"=>array("e"=>"e","f"=>"f"),"y"=>array("v","b","n")),"h"=>"h"); function arReqursive($array=false,$keyAddressLast="") { if ($array !== false) { $noKeys = true; if ($noKeys and (array_keys($array) == array_keys(array_keys($array)))) { foreach ($array as $key => $item) { if (is_array($item)) { $noKeys = false; break; } } } else { $noKeys = false; }//var_dump($noKeys); foreach ($array as $key => $item) {//echo 0; // if (array_key($array) != array_key(array_key($array))) {$noKeys = false;} if (is_array($item)) { if ($keyAddressLast == "") {//echo 1; $array = array_merge($array,arReqursive($item,$key)); // unset($array[$key]); } else {//echo 2; $array = array_merge($array,arReqursive($item,$keyAddressLast."[$key]")); } unset($array[$key]); } elseif ($keyAddressLast != "") { if ($noKeys and 0) {//Ранее ($noKeys and (array_keys($array) == array_keys(array_keys($array)))) $array[$keyAddressLast."[]"] = $item; $noKeys = false; } else { $array[$keyAddressLast."[".$key."]"] = $item; } unset($array[$key]); } } return $array; } return false; } var_dump(arReqursive($a)); Результат работы функции: array(8) { ["a"]=> string(1) "a" ["h"]=> string(1) "h" ["b[c]"]=> string(1) "1" ["b[d][e]"]=> string(1) "e" ["b[d][f]"]=> string(1) "f" ["b[y][0]"]=> string(1) "v" ["b[y][1]"]=> string(1) "b" ["b[y][2]"]=> string(1) "n" }.