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 Unit Converter Manipulating Numbers

when i submit the task 3 it says that task 2 no longer passing. Could anyone can explain this error for me please

when i submit the task 3 it says that task 2 no longer passing. Could anyone can explain this error for me please

index.php
<?php

//Place your code below this comment
$integerOne = 1;
 $integerTwo = 2;
$integerOne += 5;
$integerTwo -= 1;
$floatOne = 1.5;
 $integerOne *= $floatOne ;
echo $floatOne;
?>

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! The most common reason this will happen is because of a syntax error. However, you've run into one of those rather rare scenarios in which you've changed the value of a variable which you weren't supposed to change. In the third step, you are supposed to echo out directly the result of multiplying $integerOne with $integerTwo. But you've replaced the value of $integerOne with that result and then echoed it out.

Imagine that I add this line to the instructions: Do this without changing the values of any of the variables from the previous steps.

I think you can get it with these hints, but let me know if you're still stuck! :sparkles:

Thanks for your reply. But the thing is that still i dont understand the reason for error. So could you please explain me it more and please include the right code in your comment if you can.

Regards, Nipun

Dear I changed the code as follow and now its working .But I really dont have a clear image about this process.

$multiply = $integerOne * $floatOne;

echo $multiply ;

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! The challenge also doesn't ask you to use a new variable. It wants you to echo out the value directly like this:

echo $integerOne * $floatOne;

The reason you got the error to begin with was because you had this line:

 $integerOne *= $floatOne ;

This line takes integerOne and multiplies it by floatOne, then assigns the result back into integerOne. This means that although the value of integerOne should be 6, it is now 9.

well now the image is clear.Thank you very much.