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 cant get the answer of this challenge

Where am i going wrong?

index.php
<?php

//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
echo $integerOne+5;
echo $integerTwo-1;

?>

3 Answers

Umesh Ravji
Umesh Ravji
42,386 Points

Hi Priya, the problem is that you aren't reassigning the values that you have made to the variable values.

<?php
$integerOne = 1;
$integerOne + 5;
echo $integerOne; // 1, the value is hasn't been changed.
<?php
$integerOne = 1;
$integerOne = $integerOne + 5; // re assign the new value to $integerOne
echo $integerOne; // 6 now the value has been changed.

The code you are looking for is (don't add echo statements for your answer unless the question asks for them, as it could cause your answer to be rejected):

<?php
$integerOne = 1;
$integerTwo = 2;
$integerOne = $integerOne + 5;
$integerTwo = $integerTwo - 1;

Thanks Umesh, I really appreciate your efforts here.

Cliff Jackson
Cliff Jackson
2,887 Points

Glad i'm not the only one stuck on this one....the challenges can waste a lot of time with no hints