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 trialbilal agha
PHP Development Techdegree Student 4,509 PointsChallenge Help
hello i ma facing an error in my answer. i have been trying to solve it and watched the videos again and again but can't figure out my mistakes. can someone please help me out.
<?php
//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;
var_dump ( $integerOne );
var_dump ( 1);
var_dump ( $integerOne + 5);
var_dump ( $integerTwo );
var_dump ( 2);
var_dump ( $integerTwo - 1);
?>
3 Answers
Patricia Silva
Courses Plus Student 89,123 PointsRemove the var_dumps and check your answer. If you still have an error, post again.
Patricia Silva
Courses Plus Student 89,123 PointsThis is the out from my console:
$integerOne = 1;
< 1
$integerTwo = 2; < 2
$floatOne = 1.5; < 1.5
$integerOne +=5;
< 6
$integerTwo -=1; < 1
Chad M. Crabtree
4,406 PointsI had the same issue at first. The problem is that you need to actually assign the arithmetic operation to the variable you're trying to alter. Here is the correct solution:
<?php
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;
$integerOne = $integerOne + 5;
$integerTwo = $integerTwo - 1;
// Or you can use the shorthand version of the same thing:
$integerOne += 5;
$integerTwo -= 1;
?>
And, of course, if you wanted to display this to the console, you could do the same with var_dump()
:
<?php
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;
var_dump( $integerOne = $integerOne + 5 );
var_dump( $integerTwo = $integerTwo - 1 );
// Again, here is the shorthand:
var_dump( $integerOne += 5 );
var_dump( $integerTwo -= 1 );
?>
Hope that helps!
bilal agha
PHP Development Techdegree Student 4,509 Pointsbilal agha
PHP Development Techdegree Student 4,509 PointsI have tried, but still showing Bummer: You haven't changed $integerOne