Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP PHP Basics Unit Converter Manipulating Numbers

PHP 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!

index.php
<?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
Jeffrey Howard
18,173 Points

Hi 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!

VERY helpful!

Thank you