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

Brad Barnes
PLUS
Brad Barnes
Courses Plus Student 2,916 Points

What am I missing

When I check this code in the workspace or if you look at it in preview is displays what it is ask, but it tells me that previous task is no good.

index.php
<?php

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




?>

2 Answers

You have two problems: 1st: first time you declare full name it's not done properly, it should be $var1 . " " . $var2 or "{$var1} {$var2}" 2nd: in the last task you are not meant to reassign the variable, that's why task2 won't parse then. You should output it with text: $var . "something" or "{$var} something"

Sam Baines
Sam Baines
4,315 Points

Full code for passing the challenge incase you need it.

<?php

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

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

?>