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 trialAaron Coursolle
18,014 PointsIn the last challenge...
Hi, for whatever reason the "Get Help" button is disabled in the "String Manipulation" challenge, so that is why I'm asking this here:
I pass stage one and two with no problems but when I append to the variable in stage three I get an error saying that stage two no longer passes. Thus I can't complete the challenge.
The code works in workspaces and in the preview button available in the challenge:
<?php
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = $firstName . ' ' . $lastName;
$fullname .= ' was the original creator of PHP' . "\n";
echo $fullname;
?>
output:
Rasmus Lerdorf was the original creator of PHP
3 Answers
Jennifer Nordell
Treehouse TeacherHi there! In your first code, you are overwriting the $fullname variable which is what is causing the challenge to fail. I'm of the opinion that your second code should work, and probably does but the challenge does not ask you to create a new variable. Here's what I used:
<?php
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = $firstName . ' ' . $lastName;
echo "$fullname was the original creator of PHP\n";
?>
Hope this helps!
Aaron Coursolle
18,014 PointsThank you for your help (I hope you hit 50, 000 points before the Olympics are done)
Aaron Coursolle
18,014 PointsThe alternative fails as well. The error says "...You did NOT use the $fullname variable"
<?php
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = $firstName . ' ' . $lastName;
$newline = $fullname . ' was the original creator of PHP' . "\n";
echo $newline;
?>
Adam Fields
Full Stack JavaScript Techdegree Graduate 37,838 PointsHere is the working solution:
<?php
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = "$firstName $lastName";
echo $fullname . ' was the original creator of PHP' . "\n";
?>
Aaron Coursolle
18,014 PointsAaron Coursolle
18,014 PointsLink to challenge: https://teamtreehouse.com/library/php-basics-2/daily-exercise-program/string-manipulation