Cliff Jackson2,886 Points
can anyone figure this?
No one seems to be able to figure how to get the last part of line 3 to output correctly. I have tried a seperate echo and concatenation but neither work. Am i reading it wrong or is there a bug?
<?php include "flavor.php"; echo "Hal's favorite flavor of ice cream is". $flavor .".; $flavor = get_flavor();
Jennifer NordellTreehouse Staff
Hi there, Cliff Jackson ! You've got a couple of things going on here. First, you're missing the ending
?> tag. Secondly, we cannot be guaranteed that there is any function named
get_flavor() in the file you've imported. The challenge just specifies that the variable is defined there. So you will not need the last line.
You can use either concatenation here (as you're attempting to do now) or you can opt to use the double quotation marks to expand the value of the variable in place (interpolation). However, your current
echo statement would be correct except for two small things. You are missing an ending quotation mark after the last "." which is causing a syntax error and you forgot to account for a space before the
$flavor. I would expect to see a space between "is" and the ending quotation mark there.
But again, you could opt to not use concatenation at all. It's likely simpler to use the interpolation.
<?php $student = "Cliff"; echo "Hi there, $student! Nice to meet you."; ?>
This would echo out "Hi there, Cliff! Nice to meet you." By using the double quotation marks we can expand the variable in place without concatenation.
Hope this helps!