# 4/8 Math Function l

#1

Use the exercise window to try rounding some numbers for yourself. You can use M_PI if you like; it's my favorite floating point number.

<?php
// Try rounding a floating point number to an integer
// and print it to the screen
\$round = round(M_PI);
print \$round;
?>

<?php
// Try rounding a floating point number to 3 decimal places
// and print it to the screen
\$round_decimal = round(M_PI, 3)
print \$round_decimal;
?>

Oops, try again. Your first call to round() should print an integer.

Parse error: syntax error, unexpected T_PRINT on line 15

#2

on this line

``\$round_decimal = round(M_PI, 3)``

you forgot to end the line with a semicolon. which is why you get the parse error

``\$round_decimal = round(M_PI, 3);``

#3

I am getting the same error while doing the right thing (I guess, maybe I am actually stupid):
<?php
// Try rounding a floating point number to an integer
// and print it to the screen
\$round = round(M_PI);
print "

\$round

";
\$round2 = round(2.5 * 3);
print \$round2;
?>

<?php
// Try rounding a floating point number to 3 decimal places
// and print it to the screen
\$round3 = round(2.5*3,3);
print \$round2;
print "

\$round3

";
?>

#4

so the issue is `2.5*3 = 7.5` it only has 1 decimal place try a number with a lot more floating points e.g `14.45434534`

#5

Thank you for the feedback but it still doesn't work. I will try from zero again.

#7

HAAALP!! i don't understand why my code is wrong.
Is in spanish

<?php
\$redondear = round(M_PI);
print \$redondear;

``````?>
</p>
<p>
<?php
\$redondear_decimal = round(M_PI, 3);
print \$redondear_decimal;
?>
</p>``````

#8

Hi! there 's nothing wrong width your code, just refresh the page, i have been stock there for almost an hour, then i realize that there is nothing wrong width it. Let me show you how i have it:

\$redondear = round(1.2154);
echo \$redondear;

\$redondear_decimal = round(M_PI, 3);
echo \$redondear_decimal;

Just take me a few F5 to make it works.

#9

Same error here tried refreshing the page 100 times. Same crap it doesn't recognize the first number as an integer.

<h

<?php
// Try rounding a floating point number to an integer
// and print it to the screen
\$rounded = round(1.1410005);
print \$rounded;
?>

<?php
// Try rounding a floating point number to 3 decimal places
// and print it to the screen
\$threePlaces = round(1.1410005, 3);
print \$threePlaces;

``````?>
</p>``````