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 trial

PHP PHP Basics Daily Exercise Program String Manipulation

$fullName = "$firstName $lastName was the original creator of PHP.\n"; works in my local console but Task 3 won't accept

When I put this in for Task 3 I get "Oops! It looks like Task 2 is no longer running"

index.php
<?php

//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';

$fullName = "$firstName $lastName was the original creator of PHP.\n";
?>

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! To be clear, the challenge makes no indication whatsoever that it requires concatenation and indeed, it doesn't require concatenation. On step 3 you are to echo something, but you aren't echoing anything at the moment.

You are also overwriting what you had as the value for $fullName in step 2. As of right now, your code says that the value stored in $fullName is "Rasmus Lerdorf was the original creator of PHP \n", but that's not his name. His name is only "Rasmus Lerdorf" :smiley:

Try echoing out the value of $fullName directly.

For example:

$studentName = "Nigel";
echo "Hi there, $studentName \n";

This would echo out "Hi there, Nigel" (including a new line) to the page.

Hope this helps! :sparkles:

David Evans
David Evans
10,490 Points

Jennifer is correct. The challenge doesn't require concatenation, I was just basing off what was in the video prior to the challenge in which they used concatenation.

Sorry for the misinformation. Hope you figured out your issue.

David Evans
David Evans
10,490 Points

Hi Nigel,

The challenge is looking for you to use the concatenate ability, not just place the variables inside of quotations.

Try using concatenation ( . ) and make sure display ( echo ) the string to what would be the webpage as it asks you to do that in Step 2 of the last part of the challenge.

Post back if you have more questions, I'll be happy to help.

Thank you both for looking at this. I finally got it. I was completely forgetting to echo, so all my attempts were doomed.

The feedback I got was always "Bummer. Step 2 is no longer passing" which threw me into trying to improve step 2, even though it did already pass.

Thanks again.