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

Jessica Murillo
Jessica Murillo
9,119 Points

Changing Integer Value

It tells me to add 4 to $integerOne and subtract one from for $intergerTwo but when I add 5 to $integerOne like this $integerOne = 1+5; it tells me that $integerOne does not equal one. So I add 5 the way that I did at the bottom and when I echo out the the value it shows that it equals 6 but then I get the error saying that I haven't change the value of $intergerOne. I am not sure what I am doing wrong and I bet it is something that I am just over looking but I need help! I would really appreciate it!

index.php
<?php

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

$integerOne + 5;
$integerTwo - 2;
?>

2 Answers

Hello there, what you did is actually correct, except one thing. You did the calculations correctly but you didn't assign it to a variable so you need to fix it. With the following syntax, you can fix it =)

$integerOne = $integerOne + 5; // Or shortly: $integerOne += 5;

$integerTwo = $integerTwo - 1; // Or shortly: $integerTwo -= 1;

Since you assign the calculations you made, it needs to be fixed. Happy coding :)

Jessica Murillo
Jessica Murillo
9,119 Points

OMG! Lol yes, I forgot to set the value of integerOne and integerTwo. Thank you!

Antonio De Rose
Antonio De Rose
20,884 Points
<?php
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;

//firstly, you've been asked to add 5, and subtract 1
//now, is this how you re-assign values, for variables, when you add or subtract
//shouldn't you be needing another operator, right in front of the plus and minus operator

$integerOne + 5;
$integerTwo - 2;