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

Apparent bug in PHP challenge task three

My code is correct, but still getting a weird error that says "task 2 no longer passing" which makes no sense. The code obviously works because it shows up correctly in the preview and it also runs fine in the workspace. I must be misunderstanding the question.

$firstName = 'Rasmus'; $lastName = 'Lerdorf'; $fullname = "$firstName $lastName"; $fullname .= " was the original creator of PHP \n"; echo $fullname;

index.php
<?php

//Place your code below this comment

?>

1 Answer

andren
andren
28,558 Points

The message is a bit cryptic but it's not actually wrong. The instructions in task 2 specify that you should create a variable called $fullname and set it to "$firstName and $lastName". You might have moved on from that task but your solution has to be able to fulfill the criteria of all the tasks in order to pass the challenge.

Since you change the value of $fullname in task 3 your code no longer fulfills the criteria of task 2 since $fullname is now different from what it asked for.

You don't have to modify $fullname in order to print out the message asked for in task 3, all you need to do is use the $fullname variable inside of a new string you echo out. Like this:

<?php

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

echo "$fullname was the original creator of PHP\n";
?>