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 String Manipulation

Correct string, but wont let me pass the code challenge.

Using this code on the third part of the code challenge- <?php

//Place your code below this comment $firstName = 'Rasmus'; $lastName = 'Lerdorf'; $fullname = $firstName .' '. $lastName; echo $fullname . ' was the original creator of PHP' . "/n"; ?>

When I test it it prints exactly what is asked of in the challenge. But, it won't let me pass saying the string doesn't match what it wants. I just can't understand what I missed. Where did I go wrong?

index.php
<?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

james south
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

$fullname goes in the string. "$fullname......". do the echo as all one string and it will pass. so the newline goes immediately after PHP, ".....PHP\n". i think it matters that you use double quotes instead of single as well.

Thanks. I do have another question then. Is there any difference between what I did and putting it in the string? They both print out as the same string right?

james south
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

i don't know enough about php to say for sure but they would seem to be the same, if it's like other languages. the challenges however can be very picky and often seem to only accept one way of doing things.