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

Jeremy Dixon
Jeremy Dixon
1,621 Points

You did NOT use the $fullName variable ... even though I did

Im so confused and frustrated. I am displaying the correct string but am being told that I still fail because I didn't use the $fullName variable. But I did use the $fullName variable.... im so frustrated right now.

index.php
<?php
;
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullName = $firstName . " " . $lastName;
print $fullName . " was the original creator of PHP" . "\n"
?>

3 Answers

Rich Salvucci
Rich Salvucci
16,716 Points

I think the "\n" is what is causing it to fail the challenge. Your PHP is valid and correct, just not exactly what the challenge validator is looking for. Bugs like these are super frustrating.

Jeremy Dixon
Jeremy Dixon
1,621 Points

This bug stopped my progress in this track about month ago and I just came back to it and it is seriously making me consider cancelling my subscription. I have been paying for this for too long and have not advanced in any track far enough to be challenged in any way but bugs like this. It is the "show your work" problem. How common is this in tracks? I feel it is especially important to be clear in the instructions since the lesson is in video format which is difficult to sift through for the little bits of instruction that can help you solve these types of errors.

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

Hi there! The problem here lies in how you're displaying the results. Although it hasn't been explicitly stated, the challenge is expecting you to display the results with an echo statement as opposed to a print. I feel fairly certain that the print construct hasn't yet been covered at this point which is why they don't explicitly say it.

The big difference between a print statement and an echo statement is that the print only accepts one argument while the echo can accept multiple string arguments.

You can find the documentation here.

So, if I simply change your print to an echo, your code passes!

Hope this helps! :sparkles:

Jeremy Dixon
Jeremy Dixon
1,621 Points

Jennifer your quick clarification has reminded me why you are worth paying. Thank you very much. I have edited my comment above prior to seeing your response and I am curious what is being done/ can be done, both by those creating the lessons and myself going through them, to avoid these frustrating road blocks in the future

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

Hi, Jeremy Dixon! It's important to note that I'm not Treehouse staff. I'm a volunteer Community moderator helping out the best I can and learning right along side you. I also face these (and have faced) these same challenges! I can tell you that in my experience, Treehouse staff loves to receive feedback from its students about how they can improve the quality of their courses. In fact, many times a new course that's scheduled to be released will go through a rigorous QA by fellow Treehouse students. This is all made in an effort to make sure we all get the best education possible (including myself)!

And don't be shy about asking for help. I answer these questions not only because I enjoy it, but because I learn from it. It may be legitimately more educational for me to answer your question than it is for you to read my answer. :smiley:

edited for additional information

Having completed many of these challenges across most tracks and subjects, I do have a few pointers.

  • If you receive a "Task <number> is no longer passing" make sure your syntax is correct. The most common cause for this is a syntax error that makes the code no longer able to build/compile/interpret.
  • If you think you're overcomplicating the solution, you're probably correct.
  • Read the instructions line for line. Every word.
  • Try not to do anything the challenges don't explicitly ask for. For instance, don't leave a var_dump in your code if one is not asked for. Even if functional outside the challenge, it can cause the challenge to fail.
  • Get help if you get stuck. A second pair of eyes is always a great thing :eyes: