# Math functions 1

I don't know why it's not accepting my code???

<?php
\$round = round(MPI);
print \$round;
?>

<?php
\$round
decimal = round(MPI, 3);
print \$round
decimal;
?>

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

<?php
// Try rounding a floating point number to an integer
// and print it to the screen
// Round pi down from 3.1416...

\$round = round(M_PI);

print \$round;
// This time, round pi to 4 places

``````?>
</p>
<p>
<?php
// Try rounding a floating point number to 3 decimal places
// and print it to the screen
``````

\$rounddecimal = round(M_PI, 3);
print \$rounddecimal;
?>

##### 1 Comment

RAJAN VERMA almost 5 years ago

thanks

1 vote

MPI should be M_PI.

`````` \$round = round(M_PI);
``````

You're missing the underscores.

##### 1 Comment

Thankyou

1 vote

Try to put your statements (print) inside a "p" tag. It worked for me!

``````<html>
<p>
<?php
// Try rounding a floating point number to an integer
// and print it to the screen
\$float=1.62455211;
\$round=round(\$float);
print "The number: \$float has been rounded to: \$round";
?>
</p>
<p>
<?php
// Try rounding a floating point number to 3 decimal places
// and print it to the screen
\$floatDecThree=4.443214567;
\$roundThree=round(\$floatDecThree,3);
print "The number: \$floatDecThree has been rounded to: \$roundThree";
?>
</p>
``````

The above code looks good, yes? According to the editor it's not, I'm being told that I must round up to 3 decimal places `\$roundThree=round(\$floatDecThree,3);`

##### 1 Comment

I am having issues with this lesson as well, and again, my local host executes and prints my code properly. I could be wrong, of course, but I am pretty sure that these PHP lessons are whack.

I think that lesson is just a bit sensitive to additional text. I was getting the same error when printing output using:

``````echo "<p>{\$roundThree}</p>";
``````

but removing all extra printed text:

``````echo \$roundThree;
``````