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

Maya Liberman
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Maya Liberman
Full Stack JavaScript Techdegree Graduate 26,360 Points

numbers in integer

Why my code does not working?

index.php
<?php

//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;
$integerOne + 5;
  $integerTwo - 1;
?>

2 Answers

gioele bernardi
gioele bernardi
28,482 Points

To add a value to a variable you need to use the concatenation sintax, which is '+=' instead o just '+'.

The code under should work fine.

<?php

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

$floatOne = 1.5;

$integerOne += 5; $integerTwo -= 1; ?>

Matthew Proudman
Matthew Proudman
11,879 Points

the problem you have having are you getting PHP to do the sum but you are not telling PHP where to put the result, this can be done in two ways the fist is $thing5 = 2 + 3; and the second is $inc += 5