- The code is in double quotes and still not working.
- I already read this post
- I'm using Atom and am on localhost (if that makes any difference)
- I redownloaded Atom (in case there was something going on with the settings) and that didn't help
Here's the code:
<?php
$firstName = 'David';
$lastName = "Powers";
$title = '"The Hitchhiker\'s Guide to the Galaxy"';
$author = 'Douglas Adams';
$answer = 42;
$newLines = "\r\n\r\n";
$fullName = "$firstName $lastName |";
$book = "$title by $author";
$message = "Name: $fullName $newLines";
$message .= "Book: $book \r\n\r\n";
$message .= "Answer: $answer";
echo $message;
echo "Line 1\nLine 2";
Output is all one line, but when I view source the new lines are working
Name: David Powers | Book: "The Hitchhiker's Guide to the Galaxy" by Douglas Adams Answer: 42Line 1 Line 2
` to print newlines. You can use `nl2br()` function to do this, like `echo nl2br($message);` – Qirel Jan 04 '17 at 23:24