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 Enhancing a Simple PHP Application Integrating Validation Errors Reviewing PHP Basics

help

im stuck

output.php
<?php
include('include/flavor.php'); 
echo "Randy's favorite flavor of ice cream is ____.";

?>

1 Answer

If I remember correctly this was a test on concatenation. so the question wanted you to echo, or print to the screen the favorite flavor stored in the variable. so basically it should look something like this:

<?php
include('include/flavor.php');

echo "Randy's favorite flavor of ice cream is" . $flavor . ".";

so to recap, in php we use the period "." character as the concatenation operator. which basically appends any variable that needs to be processed to the string. So since the variable needs to come after "is" and before the period"." to end the statement, we place a concatenation operator "." before and after $flavor. Anything that's considered a string in the echo statement needs to be wrapped in quotation marks to signify its a string. That's why at the end of that statement, the period is wrapped in quotation marks.

If we just wanted to end the statement with the flavor and not the period it would look like this:

<?php
include('include/flavor.php');

echo "Randy's favorite flavor of ice cream is" . $flavor;

since there are no more string characters coming after $flavor, we can end the statement with the semi-colon. Hope this helps. I know there is more to this question, but this is all you presented, if you posted the question along with this code bit, I could probably help a little further.

Regards,

Shawn G. Jones