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

I don't know if I'm completely misunderstanding the task or the Challenge doesn't work properly

Hey everybody, I'm doing the step 3 in the String Manipulation challenge and as you can see in the index.php I'm doing everything the task ask me to do.

The $fullname string is duplicated because I was wondering if keeping a copy of the original $fullname would the challenge be okey but either way, it keeps saying boomer :(

I check the code in workspace and it is OK...I don't know how to pass it.

thanks for the help :D

index.php
<?php

//Place your code below this comment

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






echo $fullname;






?>

3 Answers

Algirdas Lalys
Algirdas Lalys
9,389 Points

Hi Lucas Nofal,

You are absolutely right your code is good, it should work perfectly in workspaces. But sometimes these challanges are expecting specific answer. Currently you are overriding your $fullname variable, that's why it doesn't let you pass I think. Task 3 "Use the $fullname variable to display the following string to the screen. Use an escape character to add a newline to the end of the string." 'Rasmus Lerdorf was the original creator of PHP'

<?php
...
$fullname = "$firstName $lastName";
echo $fullname . " was the original creator of PHP\n";
?>
Brett Marion
Brett Marion
6,915 Points

Hello Lucas,

I believe this task may be looking for the use of the concatenation operator to build your $fullname variable.

Try the following line in your code.

<?php 

$fullname = $firstName . " " . $lastName;

?>

My answer was also incorrect. Can't figure this challenge out! Any help?

Challenge: Use the $fullname variable to display the following string to the screen. Use an escape character to add a newline to the end of the string. 'Rasmus Lerdorf was the original creator of PHP'

<?php
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = "$firstName $lastName";

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

echo $string;  
?>