Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP PHP Basics Daily Exercise Program String Manipulation

I am coding this correctly, but it isnt processing the answer correctly.

as above


//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullName = "$firstName";
$fullName .= "\n";
$fullName .= $lastName;

echo $fullName;
Pontus Bolmér
Pontus Bolmér
12,471 Points

Why do you have the variable inside ""?

2 Answers

Steven Parker
Steven Parker
221,323 Points

Here's some hints:

  • as Pontus observed, you should never put a variable name in quotes
  • use a space between the two names (not a new line)
  • try combining the names (and space) in one statement using "." operators

Clearly i wasn't coding it correctly and had gone a bit loopy! Thanks people :)

Steven Parker
Steven Parker
221,323 Points

Glad I could help, and happy holidays! :christmas_tree: