PHP PHP Basics Unit Converter Manipulating Numbers

Jeff Jones
Jeff Jones
1,415 Points

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
15,269 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!

Jeff Jones
Jeff Jones
1,415 Points

VERY helpful!

Thank you