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 trialJeff Jones
3,928 PointsPHP Multiplication
Hi! For some reason this isn't making sense to me:
Question:
Multiply $integerOne by $floatOne and display the results.
Code:
<?php
//Place your code below this comment $integerOne = 1; $integerTwo = 2; $floatOne = 1.5;
$integerOne = 1 + 5; $integerTwo = 2 - 1;
$integerOne * $floatOne;
$var_dump ($integerOne * $floatOne); ?>
**When I submitted this answer, this popped up:
Bummer: Uncaught Error: Function name must be a string in index.php:13
Thanks, a lot!
<?php
//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;
$integerOne = 1 + 5;
$integerTwo = 2 - 1;
$integerOne * $floatOne;
$var_dump ($integerOne * $floatOne);
?>
1 Answer
Jeffrey Howard
18,173 PointsHi Jeff! So the last task wants us to multiply $integerOne by $floatOne and display the results. You were correct by typing:
$integerOne * $floatOne
"var_dump" is best used for when you need information about a variable(type and value) not when you need to display the final results on screen. "echo" is best used in this case for displaying the results that the challenge asked for.
Please note that the correct way to use var_dump is without the "$". Using $var_dump as you have entered above, PHP will think you are trying to use an unidentified variable when you are really trying to use the "var_dump" function.
See below how I displayed the results of multiplying $integerOne by $floatOne:
//Place your code below this comment
echo $integerOne * $floatOne;
Hope this helps. Happy coding!
Jeff Jones
3,928 PointsJeff Jones
3,928 PointsVERY helpful!
Thank you