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 trialJeff Jones
3,928 PointsPHP Integer + & -
Okay, math was never my subject, but I'm trying to figure out how to add and subtract integers on this PHP quiz I'm doing. I'm also trying to figure out how to post a picture on here as I did take a screenshot.
This question will be a lot easier to understand if I can get a picture on here.
Thanks, a lot!
4 Answers
KRIS NIKOLAISEN
54,971 PointsI can read your code. But if you want to format with markdown you can place three back ticks followed by php
before your code and three back ticks at the end of your code. Then it will look like this:
<?php
//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;
var_dump ($integerOne + 5);
var_dump ($integerTwo -1);
?>
As far as your question goes the challenge expects you to update the values. var_dump
will only display them. Here you can use either of the following
<?php
//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;
$integerOne = $integerOne + 5;
$integerTwo = $integerTwo - 1;
?>
or
<?php
//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;
$integerOne += 5;
$integerTwo -= 1;
?>
Jeff Jones
3,928 PointsSweet! Thanks
Jeff Jones
3,928 PointsThanks, Kris!
I've got a few things going on for the next several hours but I'll try and get it up here as soon as I can.
Gracias
Jeff Jones
3,928 PointsOkay, here's the question:
Add 5 to $integerOne. Subtract 1 from $integerTwo.
And here's the code:
<?php
//Place your code below this comment $integerOne = 1; $integerTwo = 2; $floatOne = 1.5; var_dump ($integerOne + 5); var_dump ($integerTwo -1); ?>
Jeff Jones
3,928 PointsLet me know if that's clear enough.
KRIS NIKOLAISEN
54,971 PointsKRIS NIKOLAISEN
54,971 PointsScreenshots are difficult to work with. One of the preferred means of sharing code is to copy/paste your code and format it using markdown. See the Markdown Cheatsheet link at the bottom for how to do so.