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

bradleymorgan
bradleymorgan
1,464 Points

I'm getting stuck on Task 3 at the end. Why doesn't this work? $a = $integerOne * floatOne; echo $a;

Full code: <?php

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

var_dump($integerOne += 5); var_dump($integerTwo -= 1);

$a = $integerOne * $floatOne; echo $a;

?>

index.php
<?php

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

var_dump($integerOne += 5);
var_dump($integerTwo -= 1);

$a = $integerOne * $floatOne;
echo $a;

?>

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! In the third step, the challenge is checking what is being printed to the screen. Your code should print one number to the screen. Instead, because you have 2 var_dump lines, it's printing three things to the screen. The challenge never asks you to do a var_dump and it's now throwing off the output.

For instance:

var_dump($integerOne += 5);

Should simply be:

$integerOne += 5;

:bulb: Note that challenges are very picky. It's always a good idea to not do anything not explicitly asked for. Even if functional, it can cause the challenge to fail.

Hope this helps! :sparkles:

This is working good but on a beginner level, here you don't need to use var_dump() because it dumps information about a variable. You can directly use like this $integerOne += 5 and eventually echo $a will provide you the desired results.

bradleymorgan
bradleymorgan
1,464 Points

Thanks guys, that solved the issue I was having. I was confused because task 2 which used var_dump was passing so I didn't think that would cause task 3 to fail.