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

Brandon Vera
Brandon Vera
672 Points

What is wrong with my code? Can someone help me?:( I'm stuck

I am multiplying the right variables but the challenge tells me im not

index.php
<?php

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

$integerOne= $integerOne + 5;
echo ($integerOne);

$integerTwo=$integerTwo - 1;
echo ($integerTwo);

$mult=$integerOne*$floatOne;
echo ($mult);

?>

5 Answers

Antonio De Rose
Antonio De Rose
20,885 Points
<?php

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

$integerOne= $integerOne + 5;
echo ($integerOne);//why is this needed, question have not asked so.

$integerTwo=$integerTwo - 1;
echo ($integerTwo);//why is this needed, not necessary.

$mult=$integerOne*$floatOne;//why is it stored in the variable, can you try echo along with multiply
echo ($mult);//then take off this line
Brandon Vera
Brandon Vera
672 Points

Challenge Tast 3 of 3 Multiply $integerOne by $floatOne and display the results.

Bummer! Are you sure you multiplied $integerOne by $floatOne? This should be the same as 6*1.5 which equals 9.

Thats what it says... If i take the 2nd and 3rd paragraph off, it shows an error that task 2 have an error

Brandon Vera
Brandon Vera
672 Points

Already tried the echo along with the multiplication but same error ocurr: Are you sure you multiplied $integerOne by $floatOne? This should be the same as 6*1.5 which equals 9.

Antonio De Rose
Antonio De Rose
20,885 Points
<?php

//first use markdownsheets, when you paste code

//Place your code below this comment 

$integerOne = 1; $integerTwo = 2; $floatOne = 1.5;

$integerOne= $integerOne + 5; echo ($integerOne);//I already told you take this echo

$integerTwo=$integerTwo - 1; echo ($integerTwo);//this echo too, I already told take it from here

echo $integerOne*$floatOne; ?>
Brandon Vera
Brandon Vera
672 Points

Thank you! Problem solved

Antonio De Rose
Antonio De Rose
20,885 Points

send me the new code, you are trying

Brandon Vera
Brandon Vera
672 Points

<?php

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

$integerOne= $integerOne + 5; echo ($integerOne);

$integerTwo=$integerTwo - 1; echo ($integerTwo);

echo $integerOne*$floatOne; ?>

Multiplication is supposed to be a 9

Phil Rice
Phil Rice
5,536 Points

i got stuck on this also and the only thing that seemed to work is :

echo $integerOne*$floatOne;

I dont think the question is very well worded though : "Multiply $integerOne by $floatOne and display the results."

which suggests you perform the operation of multiplying $integerOne by $floatOne and then you display the results rather than displaying the results of $integerOne multiplied by $floatOne - a subtle difference, but confusing when it only accepts a single way of doing things.

Please help, I still could not go out with this code challenge.

Thanks

Antonio De Rose
Antonio De Rose
20,885 Points

Hi Jayson,

Please send me the code.

Anton