I'm using the below code to create an html file using fopen and fwrite. In the html source code I trying to add carriage returns using \n, but I'm not having any luck
$filename = 'textfile.html';
$newstring = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
$newstring .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n';
$newstring .= '<head>\n';
$newstring .= '<title>IT Consulting In Your Local Area</title>\n';
$newstring .= '</head>\n';
$newstring .= '<body>\n';
$newstring .= '<p>This is a test<p>\n';
$newstring .= '</body>\n';
$newstring .= '</html>\n';
$newfile = @fopen($filename, "w+") or die ("Couldn't create file");
@fwrite($newfile, $newstring) or die ("Couldn't write to the file");
@fclose($newfile);
I'm getting the following as a result of the above code and everyhting runs together without any carriage returns. Any Ideas?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n<head>\n<title>IT Consulting In Your Local Area</title>\n</head>\n<body>\n<p>This is a test<p>\n</body>\n</html>\n