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

PHP Basic Manipulating Numbers

Getting a bummer response stating that $floatOne value is not set to 1.5

index.php
<?php

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

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

?>

3 Answers

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

Hi there! Tobias Krause is correct. You've forgotten to echo the result. However, it wants you to do this without overwriting the original values of either $floatOne or $integerOne. Overwriting the values will cause the challenge to fail even if the echo would otherwise be correct. So the last line needs to be removed and your echo can display the results directly. Take a look here:

<?php

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

$integerOne += 5;
$integerTwo -= 1;
echo $floatOne * $integerOne;

?>

Hope this helps! :sparkles:

Thanks a lot Jennifer Nordell that worked!

Oh ...yeah thats the smarter way :) I was more focused about that he wanted to set an float value to an integer. The other way around is completely fine of course. (Actually the challange did not even say to assign or change values to/of variables. Seems the callanges are not so sensitive as i thoguht)

$result = $floatOne * $integerOne;

echo $result

You need to display the value of the result. Also

$floatOne *= $integerOne;

increases the value of $floatOne which was not part of the instructions Assign the value of the multiplication to a new varaible since you can not use $integerOne because it is an integer. But the result of a multiplication of integer and float is float. So the variable with the result must be a float.

Thanks Tobias It worked well!

Tobias and Jennifer Have you been able to solve the Date function Objective task as well as the Conditional objective task ?

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

I have completed the course you're working on. So, yes. But if you have a question about another challenge, I'd highly suggest posting it as an entirely new question in the forums. This way the question will be properly linked with the challenge in question and help other students find the answer more easily :thumbsup: