Array ( [0] => tdata Object ( [image] => image1.gif [title] => file1 ) [1] => tdata Object ( [image] => image2.gif [title] => file2 ) [2] => tdata Object ( [image] => image3.gif [title] => file3 ) ) $ar1 = array(); $f = getTData();// this function returns the array above foreach ( $f as $k => $v ) { $output = ""; $output .= "