nit: why not $content .= "<body>\n</tmx>"? Generally speaking you might want to check if using heredoc syntax or output buffering wouldn't result in clearer syntax.