Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJeff Jones
3,928 PointsPHP Quiz
Hi! May I get some help on a PHP quiz?
It's asking me this:
1: Use the $fullName variable
- Display the following string to the screen. Rasmus Lerdorf was the original creator of PHP.
- Use an escape character to add a new line to the end of the screen.
Here's my code:
<?PHP
$firstName = 'Rasmus'; $lastName = 'Lerdorf'; $fullName = $firstName . ' ' . $lastName; echo fullName $fullName = 'Rasmus Lerdorf was the original creator of PHP. \n'; ?>
I can't get the right answer, but I think my trouble is with the 'escape character' part on #3. Thanks for your help!
2 Answers
jb30
44,807 PointsI get a syntax error when I try the line echo fullName $fullName = 'Rasmus Lerdorf was the original creator of PHP. \n';
If you add a semicolon after echo fullName
, then your program will print out the string fullName
. It will then assign the new value to $fullName
, which you never use.
Your escape character is fine.
Instead of changing the value of $fullName
, try echo $fullName . ' was the original creator of PHP.\n';
Jeff Jones
3,928 PointsThank you! That worked !!