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 trialWK h
2,924 PointsHow to add single quote inside a double quote and output as a string?
Since the challenge task 3 require to output the result start with single quote and end with single quote. I did use double quote to actually wrap the single quote inside but in the end its say task 2 is not passing? I know there should be something went wrong but I couldnt find it. Thanks in advanced.
<?php
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = $firstName . " " . $lastName;
$fullname = "'" . $fullname . " was the original creator of PHP '" . "\n" ;
//Place your code below this comment
?>
1 Answer
Jasper Bloem
22,424 PointsHey WK h,
The challenge doesn't require you to output the single quotes around the output. And pay attention when to use single or double quotes.
This is the answer if you're curious!
<?php
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = "$firstName $lastName";
echo "$fullname was the original creator of PHP\n";
?>
WK h
2,924 PointsWK h
2,924 PointsThank you so much for resolve the issue i encounter, as you say i did confuse about the use of single quote and double quote. Again, thank you so much.