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

Tim Arnold
Tim Arnold
440 Points

This works in the playground? What's wrong? This happened in an SQL report task too.

Why when I run this does it say task 2 isn't working? I've already passed task 2 and this is the last task.

Task 2 was to add 5 to $integerOne and subtract 1 from $integerTwo. I tried --$in...Two; and $int...Two - 1;

Thanks

index.php
<?php

//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;

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

$integerOne = $integerOne * $floatOne;
var_dump($integerOne);
?>

3 Answers

Andrey Misikhin
Andrey Misikhin
16,529 Points
<?php

//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;

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


echo $integerOne * $floatOne;

?>
Tim Arnold
Tim Arnold
440 Points

Hey Andrey,

I had this thought after and tried echo but it still wasn't working?? However after seeing your reply I went back in and it has worked now. I may have had = after echo?

Thanks for your help. Tim

Andrey Misikhin
Andrey Misikhin
16,529 Points

I think, you changed value of variable $integerOne and it is caused error.