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

John Waitt
John Waitt
2,510 Points

Attempting to complete Step 3 of the challenge after the unit converter.

Step 2 validates, but step 3 throws an error, "Oops! It looks like Task 2 is no longer passing." And the output looks correct to me. My code follows:

<?php

//Place your code below this comment $integerOne = 1; $integerTwo = 2;

$integerOne += 5; $integerTwo -= 1;

$floatOne = 1.5; $integerOne *= $floatOne; echo $integerOne; ?>

What am I not seeing?

2 Answers

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

Hi there! Your code is functional and it does produce the output you would expect. However, the challenge wants you to do this without overwriting the value of $integerOne. Currently, the end value of $integerOne is 9 because you have this line:

$integerOne *= $floatOne;

Try again by echoing directly $integerOne times $floatOne. If these hints weren't enough, please let me know. Good luck! :sparkles:

John Waitt
John Waitt
2,510 Points

Thank you. Interestingly, I got around it by creating a new variable $result to hold the result of the multiplication and echoing that instead. Which I thought was odd because the parser can't possibly be looking for that variable. How do they know that my final result was correct without validating that?

John Waitt
John Waitt
2,510 Points

Also interesting, in the third step I tried:

''' $result = $integerOne * $floatOne; echo 9; '''

And it passed the end of the challenge. Heh.