PHP PHP Basics Unit Converter Manipulating Numbers

I can't seem to find the error in my php code

I passed the first two stages correctly, but in the 3rd stage (final stage) I keep getting an error. What is wrong with the code?

Please help me.

Thanks

index.php
<?php

//Place your code below this comment

  $integerOne = 1;
  $integerTwo = 2;

  $floatOne = 1.5;

  echo($integerOne += 5);
  echo($integerTwo --);


  echo($integerOne * $floatOne);

?>

The error I get: "Bummer: Are you sure you multiplied $integerOne by $floatOne? This should be the same as 6*1.5 which equals 9."

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Staff

Hi there, Mostafa Alhosain ! The problem lies in the output. As Molly James has noted there are two extraneous echo statements. There should only be one echo statement and it should be the last one you have.

If you check under "preview" with your current code, you'll note that it's printing out "629". The first echo statement prints out 6. The next, 2 and the next prints 9. But it's expecting to only see "9" printed :smiley:

Removing the echo from around the $integerOne += 5 and $integerTwo-- will result in the correct output.

Hope this helps! :sparkles:

Molly James
Molly James
18,382 Points

There's no need for the echo statements on your second stage. By adding them, the second call to the variable refers back to the previous declaration, in this case the first line.