<?php $array = array( 0=> 'arfan', 1=> 'haider', 2=> array( 0=> 'azeem', 1=> 'jeme', ), 3=> array( 0=> 'haider', 1=> 'one' ) ); echo "<pre>"; print_r($array); echo "</pre>"; $arr = iterator_to_array( new RecursiveIteratorIterator(new RecursiveArrayIterator($ar ray)), 0); echo "<pre>"; print_r($arr); echo "</pre>"; ?>
Friday, May 11, 2012
How to convert 2-demensional array in 1-demednsional array in php?
0
if you want to convet 2-dimensional array to 1-dimensional array following coding doing exactly without using foreach loop or while loop or for loop