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 trialBrian Humphrey
Courses Plus Student 372 PointsI've tried this problems a few times and I cant see what's wrong with my code
Can somebody tell me why my answer is wrong?
<?php
//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$integerOne += 5;
$integerTwo -= 1;
echo $integerOne;
echo $integerTwo;
$floatOne = 1.5;
echo ($integerOne * $floatOne);
?>
2 Answers
andren
28,558 PointsThe challenge is looking at the output of your program (what you print with echo) to determine if you are doing the correct thing. The issue is that you echo out the contents of $integerOne
and $integerTwo
which is not something the task asked you to do. If you remove those echo
lines like this:
<?php
//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$integerOne += 5;
$integerTwo -= 1;
$floatOne = 1.5;
echo ($integerOne * $floatOne);
?>
Then your code will be accepted. Since challenges are often very picky you are usually better of not including any code that was not explicitly asked for.
Brian Humphrey
Courses Plus Student 372 PointsI copied it word for word. I think its a little glitchy, but thanks for the help anyways andren.
Brian Humphrey
Courses Plus Student 372 PointsBrian Humphrey
Courses Plus Student 372 PointsI tried it your way also, and it asked me if I multiplied correctly.
andren
28,558 Pointsandren
28,558 PointsDid you copy the code exactly? I tested the code before I posted it and it accepted it without issues for me. The challenges can be a bit buggy at times, so maybe try resetting the challenge and copy and paste the code I showed exactly. That should work.