This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by William Gao
almost 11 years

Why doesn't this pass

What is wrong with my code

Answer 5180b5fad427697d3a00104e

6 votes

Permalink

Hope That Helps

<?php
// Try rounding a floating point number to an integer
// and print it to the screen
$round = round(M_PI);
echo $round
?>
</p>
<p>
<?php
// Try rounding a floating point number to 3 decimal places
// and print it to the screen
$test = round(M_PI, 3);
echo $test
?>
points
Submitted by roun512
almost 11 years

3 comments

Amanuel almost 10 years

THX

Thank you! So that’s the problem with being two PHP.

And the exercise only uses one. Please, somebody fix it.

Answer 516f1c44ad5643e38f001091

2 votes

Permalink

The variable $rounddecimal isn’t equal to $round_decimal

points
Submitted by Ben
almost 11 years

3 comments

William Gao almost 11 years

Even if I fix it, it still gives me the error message

You’re also missing the underscore for the M_PI constant in the $rounddecimal variable.

He’s not forgetting. Notice the italic that’s made with underlines.

Answer 516e760bbb9934d02a004a72

1 vote

Permalink

When you print your round decimal you have added an underscore to the variable name. Does that fix it?

points
Submitted by Simon Craig
almost 11 years

Answer 5173dde7ff3395e90500177a

0 votes

Permalink

Never mind, I should have put 3 instead of two

points
Submitted by William Gao
almost 11 years

Answer 5170f501de5021c0f4001af6

-3 votes

Permalink

points
Submitted by Kaushik Kishore
almost 11 years

1 comments

William Gao almost 11 years

It still says Oops, try again! Your second call to round() should print a floating point number with exactly 3 digits after the decimal.