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

Chris Mastrogiacomo
Chris Mastrogiacomo
990 Points

Has anyone had a problem with this Challenge" I think it is broken.

I am stuck on this PHP Basics challenge. I think it is broken because my script works in the preview and in Workspaces.

Challenge Task 3 of 3 Create a New Float Variable named $floatOne with a value of 1.5. Without changing the value of $integerOne or $floatOne, multiply $integerOne by $floatOne and display the results.

ERROR: Bummer! Are you sure you multiplied correctly?

My Script: <?php

//Place your code below this comment $integerOne = 1; $integerTwo = 2; $integerOne += 5; $integerTwo -= 1; $floatOne = 1.5; $results = $integerOne * $floatOne; echo "The result = "; echo $results;

?>

Hazem mosaad
Hazem mosaad
15,384 Points

please challenge link :) thanks

1 Answer

Daniel Gauthier
Daniel Gauthier
15,000 Points

Hey Chris,

You added your own flavor to the echo statements, and the parser was not kind in the taste test :D

One thing with these challenges is that they punish going off the rails even a little when they're looking for a line of code. By using two echo statements, and adding the "The result = " parts, the parser decided it was definitely not equal to what it was looking for.

The code the challenge is looking for is:

<?php

$integerOne = 1;
$integerTwo = 2;
$floatOne = 1.5;

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

echo $floatOne * $integerOne;

?>

Or, you can also place the creation of the third variable before the echo statement:

<?php

$integerOne = 1;
$integerTwo = 2;

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

$floatOne = 1.5;

echo $floatOne * $integerOne;

?>

Good luck with the course!