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 trialThomas Hodek
1,913 PointsWhat's wrong with my code? (basic php challenge)
It keeps saying task 1 is incorrect but i already passed it. Can someone help?
<?php
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = "$firstName $lastName";
echo "$fullname was the original creator of PHP"\n;
?>
2 Answers
Umesh Ravji
42,386 PointsHi Thomas, usually when you already passed a challenge, and then in the future it says a previous challenge isn't passing anymore, it usually means that something in your code is actually causing an error (preventing it from running correctly).
<?php
echo "$fullname was the original creator of PHP"\n;
The \n
is outside of the the string quotes, giving you an error (you can go click on preview to see the error): PHP Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting ',' or ';' in index.php on line 7 Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting ',' or ';' in index.php on line 7 Errors parsing index.php
I'm sure you can fix this, but here it is if anyone ever comes across this in the future :)
<?php
echo "$fullname was the original creator of PHP\n";
Thomas Hodek
1,913 PointsHi Umesh,
Thanks so much for your answer, it did work! :))
I'm glad i wasn't too far a way from the correct solution.