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

This is some silliness.

I typed out the code in brackets got the result that the quiz asked for but said was wrong.

read and re read on how the \n is to be used. https://stackoverflow.com/questions/13741485/n-or-n-in-php-echo-not-print}

<?php $firstName = 'Rasmus'; $lastName = 'Lerdorf'; $fullName = "$firstName" . " " . "$lastName" . " was the original creator of PHP"; echo $fullName; // I left this out of the quiz answer.

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

$fullName = "$firstName" . " " . "$lastName" . " was the original creator of PHP";
echo $fullName; // I left this out of the quiz answer.

?>

When I attempted to add the "NEW LINE" I did so as follows. Making sure I used double quotes instead of single quotes.

This one made the most sense for what was being asked. $fullName = "$firstName" . " " . "$lastName \n " . " was the original creator of PHP"; This one made no sense but I was willing to try it. $fullName = "$firstName" . " " . "$lastName" . " was the original creator of PHP \n"; This one made sense also. $fullName = "$firstName" . " " . "$lastName" . "\n" . " was the original creator of PHP";

Thanks in advance for some input.

index.php
<?php

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

    $fullName = 
?>

2 Answers

Robert Bennett
Robert Bennett
11,927 Points

$firstName = 'Rasmus';

$lastName = 'Lerdorf';

$fullName = $firstName . ' ' . $lastName;

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

ah now I see what needed to be done. The 1st task in part 3 was to Use the $fullName variable to DISPLAY aka ECHO the following string TO THE SCREEN.

Thank you Robert for your help once again.

Robert Bennett
Robert Bennett
11,927 Points

Never give up! I hope you become a great programmer...

I wont, and thank you again. Cheers.