"Swift 2.0 Functions" was retired on May 31, 2020. You are now viewing the recommended replacement.

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

Natasha Brame
Natasha Brame
1,091 Points

Adding to integers

I am currently carrying out challenge task 2 out of 3 in the unit converter for manipulating numbers. I am struggling to understand how to answer this question. If someone is able to help.

index.php
<?php

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

1 Answer

Steven Parker
Steven Parker
243,134 Points

The instructions say "Add 5 to $integerOne. Subtract 1 from $integerTwo.", but as the error message ("Bummer: You haven't changed $integerOne") tells you, the current code only displays the increased value, it does not change the value stored in the variable.

To do that, you'd need an assignment, like: $integerOne = $integerOne + 5;, or the more compact form: $integerOne += 5;

Also, the instructions don't ask you to display the changed value.