Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP PHP Basics Daily Exercise Program String Manipulation

daniel Couzens
daniel Couzens
4,759 Points

task 3?!

I though this would solve my issue but no joy! Can anyone help?

index.php
<?php

//Place your code below this comment

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

$fullName = "$firstName $lastName";
$fullName .= "was the original creator of PHP.";
$fullName .= "\n"; 

echo $fullName;
?>

1 Answer

You are awful close but if you stop and think about it for a minute if you wanted to show this person's first name a second time on a page it wouldn't make complete sense right? Because you have his name and then some other stuff after it. What you're really after is this:

<?php

//Place your code below this comment

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

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

This way you can also echo this without it having that he was also the creator of PHP the second time

<?php
echo $fullName . " has a really awesome first name.\n";