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

Maria H
Maria H
6,737 Points

I am confused, receiving Make sure you use "echo" instead of "var_dump" error

I don't think I have seen an example of using echo to multiply integers so am not sure what I am doing wrong.

index.php
<?php

//Place your code below this comment
 $integerOne = 1;
  $integerTwo = 2;
 $floatOne = 1.5;

var_dump ($integerOne +=5);

var_dump ($integerTwo -=1);

var_dump($integerOne * $floatOne);
?>

3 Answers

Mike Whitney
Mike Whitney
381 Points

Thank you Maria H, you saved me this morning! I believe the wording on the question should be more clear as the concepts in the previous lesson do not explain this very well.

Maria H
Maria H
6,737 Points

I've been saved by other peoples questions too, sometimes just reading the problem from a different perspective helps. I'm glad you figured it out! Double checking your code with a PHP Validator can be helpful too.

https://phpcodechecker.com/ is a good tool.

jamesjones21
jamesjones21
9,260 Points

Hi Maria,

var_dump() outputs the variable in a readable format, which is useful for looking at arrays or a variable that will not be output to the screen.

you are almost there :)

In this challenge, you will require to use the keyword echo:

echo $integerOne +=5;
echo $integerTwo -=1;
echo $integerOne * $floatOne;
Maria H
Maria H
6,737 Points

I tried and was still recieving an error code( Bummer: Are you sure you multiplied $integerOne by $floatOne? This should be the same as 6*1.5 which equals 9).

When I removed echo from $ integerOne and $integerTwo and only echoed out the last equation it worked.

$integerOne +=5; $integerTwo -=1; echo $integerOne * $floatOne;