public static function getTitlesAsCsv($seedKeyword, $groupTitles) { $res = LDao::getTitles($seedKeyword, $groupTitles); if ($res !== false) { $titleCsv = array(); foreach ($res as $dbrow) { if (count($titleCsv) == 0) { foreach ($dbrow as $header => $vals) { $str .= $header . self::CSV_DELIMITER; } $titleCsv[] = $str; } $str = ''; foreach ($dbrow as $vals) { $str .= $vals . self::CSV_DELIMITER; } $titleCsv[] = $str; } } return $titleCsv; }