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

PHP test errors

Hi. I keep on getting errors for this test and I'm unsure what the issue is. The first two steps always pass, but once I get to the third part of the test, the second step begins to fail. I've tried to do the concatenation on a single line, multiple lines, etc. But I get the same error.

index.php
<?php

//Place your code below this comment
$firstName = "Rasmus";
$lastName = "Lerdorf";
$fullname = "$firstName ";
$fullname .= "$lastName";
$fullname .= "was the original creator of PHP";
$fullname .= "\n";

?>

You're missing a space between the $lastName and "was". So add a space on one of those. So the output currently is:

Rasmus Lerdorfwas the original creator of PHP
             ^
missing space

Thanks Christian Andersson! I don't think that's the issue that's causing the error though. Still getting a message that says step 2 is now failing.

1 Answer

Joe Schultz
Joe Schultz
6,191 Points

The only way I could get this to work is to concatenate a space between the $firstName and $lastName. Also you need to echo out the final statement. It should look something like this:

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