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

Abe Abdelmagid
Abe Abdelmagid
3,181 Points

what is wrong here ?

I got oops

index.php
<?php

//Place your code below this comment

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

3 Answers

Greg Kaleka
Greg Kaleka
39,021 Points

Hi there,

You're very close! There are a few issues with your code. I've added comments below.

yourcode.php
<?php

//Place your code below this comment

$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = 'Rasmus Lendrof'; // this is cheating! delete this line of code
$fullname = $firstName .' '.$lastName. // This is right but end your line with a ; and not a .
$fullname = $fullname . " was the original creator of PHP" . "\n" ; // instructions say to display to the screen
?>

So with those minor tweaks we end up with:

solution.php
<?php

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

Hope that makes sense.

Cheers :beers:

-Greg

Umesh Ravji
Umesh Ravji
42,386 Points
$fullname = 'Rasmus Lendrof';

Remove this line, you are using $firstName and $lastName to create this variable.

$fullname = $firstName .' '.$lastName.

Dot at the end instead of semicolon.

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

At the end you are supposed to display the result, not place it into the variable.

Eric Breuers
PLUS
Eric Breuers
Courses Plus Student 19,270 Points

Sorry Abe, I haven't been on in a while. It looks like Greg has you covered! :)