0){ for($i = 0;$i < count($report['contents']); $i++){ $aux = explode("-",$report['contents'][$i]['subtitle']); $report['contents'][$i]['subtitle'] = db_get_value ("alias","tagente","nombre",$report['contents'][$i]['agent_name']) .' -'. $aux[1]; } } $xml = null; $xml = array2XML($report, "report", $xml); $xml = preg_replace("/(<[^>]+>)(<[^>]+>)(<[^>]+>)/", "$1\n$2\n$3", $xml); $xml = preg_replace("/(<[^>]+>)(<[^>]+>)/", "$1\n$2", $xml); // Return if is marked to return if ($return) return $xml; // Download if marked to download header ('Content-Type: application/xml; charset=UTF-8'); header ('Content-Disposition: attachment; filename="'.$filename.'.xml"'); // Clean the output buffer ob_clean(); echo $xml; }