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

Daron Anderson
Daron Anderson
2,567 Points

PHP Basics

I add 5 and minus 1 and I keep getting an error can anyone help?

index.php
<?php

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

?>

4 Answers

Fahri Can
Fahri Can
9,921 Points

What is the exact error message you get? Did you tried to echo both numbers?

Christopher Debove
PLUS
Christopher Debove
Courses Plus Student 18,373 Points

You need to do the operations in two step: Initialization and Update =>

<?php

$integerOne = 1;
$integerOne = $integerOne + 5;

?>
Scott Yardley
Scott Yardley
20,663 Points

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

Christopher Debove
Christopher Debove
Courses Plus Student 18,373 Points

Nope, won't work with this challenge. The challenge is based on a specific method to do the operations.

EDIT : But your code is actually valid =)

Scott Yardley
Scott Yardley
20,663 Points

$integerOne = 1; $integerOne +=5; $integerTwo = 2; $integerTwo -=1;