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 trialpatricklooi
930 PointsHello.. i've issue with the third question at manipulating-numbers
<?php
//Place your code below this comment $integerOne = 1; $integerTwo = 2;
$integerOne = $integerOne + 5; $integerTwo = $integerTwo - 1; $floatOne = 1.5 ;
var_dump ($integerOne*$floatOne);
echo "Display = "; echo $integerOne; echo " First : "; echo $floatOne; echo " Second";
//please tell me what's the issue :( ?>
<?php
//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$integerOne = $integerOne + 5;
$integerTwo = $integerTwo - 1;
$floatOne = 1.5 ;
var_dump ($integerOne*$floatOne);
echo "Display = ";
echo $integerOne;
echo " First : ";
echo $floatOne;
echo " Second";
?>
2 Answers
Joel Bardsley
31,249 PointsHi Patrick,
You have the sum correct, you just don't have to do anything fancy with the displaying of the answer. Instead of using a var_dump and several echo statements, just directly echo out the sum that you've used inside the var_dump and it will pass the challenge.
anthony winslade
846 PointsYou are nearly at the answer.
You have 2 choices either change the 'var_dump' to an echo like suggested above
Or you can do this
Add a new variable for example called result and initialize it to 0 like this
$result =0;
Then assign the value of the multiplication and store it in this variable so 'var_dump' becomes
$result = (integerOne * floatOne);
Then simply echo the variable
echo $result;
And it should display a value of 9 and pass the test
<?php
//Place your code below this comment $integerOne = 1; $integerTwo = 2;
$result = 0;
$integerOne = $integerOne + 5; $integerTwo = $integerTwo - 1; $floatOne = 1.5 ;
$result = ($integerOne*$floatOne);
echo $result;
?>
patricklooi
930 Pointspatricklooi
930 Pointshello Joel:) Yes I've applied that without the other descriptions and it worked! thanks a lot Joel <3 anthony winslade that's okay my issue has been resolved! thank you too :)