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 Booleans

Aaron Coursolle
Aaron Coursolle
18,014 Points

In 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
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi 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! :sparkles:

Aaron Coursolle
Aaron Coursolle
18,014 Points

Thank you for your help (I hope you hit 50, 000 points before the Olympics are done)

Aaron Coursolle
Aaron Coursolle
18,014 Points

The 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;
?>

Here is the working solution:

<?php

$firstName = 'Rasmus';
$lastName = 'Lerdorf';

$fullname = "$firstName $lastName";

echo $fullname . ' was the original creator of PHP' . "\n";

?>