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

Concatenation in PHP

I am stuck on this code in my Beginner PHP course. I want to print out to the screen the first name, last name, "was the original creator of PHP" and use an escape character.

Can anyone show me where my code is wrong?

[code]

<?php

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

$fullName = $firstName." ".$lastName;

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

[/code]

1 Answer

Hi Aaron,

That's almost true. Issue the command "echo" and use the newline character only at the end! Use doubleqoutes for the text to interpret the newline character. I've included the solution below.

I hope I could help you out.

<?php

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

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

?>

It does Philipp, I was saying echo $fullName = $firstName." ".$lastName." ". was the original creator of PHP.";

Glad you cleared that up for me.

Thank you