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 trial

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 Teacher

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,386 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.