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 Combining Strings

Mark Lawson
Mark Lawson
6,148 Points

Having trouble with Concatenation

I have copied exactly as the course has show; for some reason I am getting an error. Can anyone see what I am doing wrong?

Thanks

<?php

$name = 'Mark'; $string_one = "Learning to display \"Hello $name!\" to the screen.\n"; $string_one = 'Learning to display ' . \"Hello $name . '!\" to the screen.\n'; echo $string_one;

?>

Mark Lawson
Mark Lawson
6,148 Points

Its okay, I have spotted the mistake. Thanks

1 Answer

mohammed saleh
mohammed saleh
3,749 Points
<?php

$name = 'Mark'; 
$string_one = "Learning to display \"Hello $name!\" to the screen.\n";
$string_one = 'Learning to display ' . "\"Hello $name . '!\" to the screen.\n'";
echo $string_one;