Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP PHP Basics Unit Converter Manipulating Numbers

Daron Anderson
Daron Anderson
2,566 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,372 Points

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

<?php

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

?>
Scott Yardley
Scott Yardley
15,833 Points

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

Christopher Debove
Christopher Debove
Courses Plus Student 18,372 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
15,833 Points

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