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

Use the $fullname variable to display the following string to the screen. Use an escape character to add a new line

I am not sure how to do this question..... Help!

index.php
<?php

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

2 Answers

Carl Whedbee
Carl Whedbee
18,577 Points

The values of the variables $firstName and $lastName should be quoted strings. For $fullname variable, use concatenation to combine the two variables and don't forget to add a space in between $firstName and $lastName. Use the $fullname variable to replace Rasmus Lerdorf, use concatenation for the rest of the string, also adding the new line escape character at the end before you close the string.

Aurelian Spodarec
Aurelian Spodarec
10,801 Points

So you store variable first and last name, with the name..

Now you need to display those variables in the string. You need to concatinate. You don't need to write his name there, but put the variable, that's what variables are for, holding values.

I think you might want to re-watch the video. This is very basic. I'm not into PHP so can't tell you the syntax, but It will be good if you re-watch the video, and look at it again, usually people don't get it first time, and need to re-watch stuff. Heck I re-watched HTML Basics few times.