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 trialTammy Scarborough
544 PointsMy answer is working in my workspace but is wrong in the quiz
$integerOne = 1 $integerTwo = 2 Q: Add 5 to $integerOne AND subtract 1 from $integerTwo My answer works in my Treehouse Workspace but the question in the quiz keeps telling me it's incorrect:
<?php
$integerOne = 1; $integerTwo = 2;
$a = 5; $b = 1;
var_dump($integerOne + $a); var_dump($integerTwo - $b);
echo $a; echo $b;
?>
I've tried several times. What am I doing wrong?
<?php
//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$a = 5;
$b = 1;
var_dump($integerOne + $a);
var_dump($integerTwo - $b);
echo $a;
echo $b;
?>
2 Answers
Jacob Herrington
15,835 PointsI see why you chose to do what you did, but try to keep in mind that the world of programming is incredibly literal. In all honesty, you are over-complicating it a bit.
This code passes the 2nd task:
<?php
$integerOne = 1;
$integerTwo = 2;
$integerOne += 5;
$integerTwo -= 1;
?>
Do you see how I did this differently?
Tammy Scarborough
544 PointsThanks, Jacob. I see what you did. I do recall watching the video and that being explained. Thanks for your help :-)