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 trialISM HD
Courses Plus Student 216 Pointsmultiply integer by float
Multiply $integerOne by $floatOne and display the results ??? $integerOne = 6; $floatOne = 1.5;
<?php
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;
$integerOne += 5;
echo $integerOne;
$integerTwo--;
echo $integerTwo;
echo $floatOne * $integerOne ;
?>
2 Answers
jamesjones21
9,260 Pointsyou need to create a new variable and then assign it $integerOne * $floatOne
Like so:
<?php
//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;
$integerOne = $integerOne + 5;
$integerTwo = $integerTwo - 1;
$multiply = $integerOne * $floatOne;
echo $multiply;
?>
Adam N
70,280 PointsYou just need to make sure that your script only includes things that the tasks have asked for. The way you're multiplying is fine
Let me know if this helps here
jamesjones21
9,260 Pointsthe above code I did actually passed the challenge, I guess you marked it down as not worthy?
Adam N
70,280 PointsBased on what the tasks say to do I don't think your answer is that great. It's all good, tho.
jamesjones21
9,260 Pointsas mentioned only include what the task is asking for, which is what the solution above does. If you think its bad, then why not elaborate and provide an answer.....
Adam N
70,280 PointsThe third task never asks for a new variable to be created. It just asks for the multiplication to be echo'd out.
jamesjones21
9,260 Pointsit may have not mentioned to create a new variable but least it's held in a variable so that it makes it easier to read, just my approach to doing it.
ISM HD
Courses Plus Student 216 Pointsthanks again :)
Adam N
70,280 Pointsnp! You can mark this question as solved by selecting a "best answer".
ISM HD
Courses Plus Student 216 PointsISM HD
Courses Plus Student 216 PointsThank u bro