Hi,Dear Frnds...............I Hope u are all fine. I am using the PHP and I want to convert the 2-demensional array in 1-demensional array. Here is the code. $frnd1 = array( 0=> 'arfan', 1=> 'haider', 2=> array( 0=> 'azeem', 1=> 'jeme', ), 3=> array( 0=> 'haider', 1=> 'one' ) ); Code (markup): I want to convert this array in simple array. Suppose it is bulit dynamically Then what I did do? ........Thanks......
function toOneDimension($inputArray) { $resultArray = array(); foreach ($inputArray as $element) { if (is_array($element)) { $resultArray = array_merge($resultArray, toOneDimension($resultArray)); } else { $resultArray[] = $element; } } return $resultArray; } PHP: This code should work, haven't tested myself.