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

Miguel Nunez
Miguel Nunez
3,266 Points

Add 5 to $integerOne. Subtract 1 from $integerTwo.

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

5 Answers

Daniel Gauthier
Daniel Gauthier
15,000 Points

Hey Miguel,

The challenge is looking for the following code:

<?php

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

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

The challenge basically wants to see you use those += and -= operators, while also showing you know the difference between initializing a variable (first step) and manipulating them (second step).

Good luck with the course!

Daron Anderson
Daron Anderson
2,567 Points

Thank You Daniel For the answer it helped, and thank n.you Miguel for asking the question!

The Longer way xD

<?php

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

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

Took me some time to understand, but also found out this post. never thought of using the += or -= operators and also the question was bit confusing, but somehow this worked, thereafter i just wanted to see if there was any other answer, thanks to this post i found a shorter way to complete the same question.

Adios Daniel Gauthier thanks man..thanks alot xD

Enea Jorgji
Enea Jorgji
6,038 Points

I was trying the short way, but it took me some time to understand xD

For more context this is part of the Assignment Operators http://php.net/manual/en/language.operators.assignment.php

Greg Sargent
Greg Sargent
3,942 Points

Wow I would never have thought to use those operators. Thanks for sharing!

Thank you! I wouldn't have figured out to use those operators either