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

step two of end of lesson exam and I cant get through. what am I doing wrong??

it wants me to add 5 to integer 1 and subtract 1 from integer two. this is how I wrote it and It wont pass me through. tried a few other ways too and nothing. is there a bug in the test or am I wrong? show me the right way anyone???

<?php

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

                                             /*I added this below to add to part one*/

var_dump($integerOne + 5) ;
var_dump($integerTwo - 1) ;
?>

1 Answer

Greg Kaleka
Greg Kaleka
39,021 Points

There are two problems with your code:

  1. You're missing a semicolon after you declare $floatOne. This will cause a syntax error.
  2. You're var_dumping the result of the math. You need to actually change the value of the variables as shown below.
<?php
$number = 5;
$number = $number + 10;

Cheers :beers:

-Greg

thanks a lot for the reply Greg! I took a break and started from scratch and was able to figure it out. and yes, that's exactly what I did wrong and had to do.