This forum is now read-only. Please use our new forums at

Functions, Part I Forum

View Course » View Exercise

1157 points
Submitted by
almost 2 years ago

1.4: But this IS an integer...

My code:

$round = round(MPI);
print $round;

decimal = round(MPI, 2);
print $round


This code apparently does not print an integer for "round(M_PI)" when it should round to 3.
Any idea what's wrong?

0 votes


you forgot to write "?>" after 'print $round;'
and it's 'M_PI' not 'MPI'

709 points
Submitted by
Magnus RC
almost 2 years ago


1fd1601a6654f4f1164c8bc7b19f2358?s=140&d=retro Bryan almost 2 years ago

Actually, I typed out MPI with an underscore, but for some reason when I typed out the question in the forum it defaulted to italic instead of underscore. So yes, I typed MPI.

01e469b9f86ef7e4f8f6c38a30adbce8?s=140&d=retro Colls almost 2 years ago

Try typing $rounddecimal = round(M_PI, 3); instead of the 2. This worked for me