php multidimensional array to single dimension array
<?php
php convert multidimensional array to single dimension array
convert multidimensional array to single array php
function multidimensional_array_to_single_dimension_array($array) {
if (!$array) return false;
$flat = array();
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($array));
foreach ($iterator as $value) $singhal[] = $value;
return $singhal;
}
$arr=array(1,2,array(4,5),6,array(7,8,array(9,10,11,array(12,13,14))));
print_r(multidimensional_array_to_single_dimension_array($arr));
?>
OUTPUT:Array ( [0] => 1 [1] => 2 [2] => 4 [3] => 5 [4] => 6 [5] => 7 [6] => 8 [7] => 9 [8] => 10 [9] => 11 [10] => 12 [11] => 13 [12] => 14 )
Thanks.. its very different.
ReplyDeleteTouche. Solid arguments. Keep up the amazing spirit.
ReplyDeleteI have read so many articles or reviews on the topic
ReplyDeleteof the blogger lovers but this article is actually a good piece of writing, keep it up.
Expert plastic extrusion companies serve the vital function of creating specific shapes out of hard plastic that are used to make various other products like
ReplyDeletetubing, casing, and more. The twist should also be
built to meet a given style of die. Extruders may be divided into three general types :.
Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging
ReplyDeleteBest Dot Net Training Institute In Chennai | Dot Net Training And Placement In Chennai | Best Dot Net Training In Chennai
Best Software Testing Training Institute In Chennai With Placement | Software Testing Training Institute In Chennai
Java Training Institute in Chennai | Core Java Training in Chennai | Java Certification in Chennai
PHP Course in Chennai | PHP Training Institute in Chennai | PHP Course and Certification