Okay, here's the deal--ya'll might remember me, I was here a long as time ago, been away learning PHP--anyways, I am almost finished what I have been working on, but I need to either figure out how to use ereg() or is there another way to round off a number?
Basically say I have a number like pi
3.14652642 <-- Not quite, but close.
I want to -always- round it up. So I need it to hit 4 - what'd I do?
Now my major problem--at least in my head--is that, I don't understand ereg() - and the rounding needs to take place in a certain file--like user_info.php--so... does this make sense, and can anyone explain to me what i should do?
ereg() or better way of rounding off?
Moderator: General Moderators
Try:
This will return:
4
more info is available here:
http://www.php.net/ceil
Code: Select all
<?php
$testnum = ceil(3.14652642 );
echo $testnum;
?>4
more info is available here:
http://www.php.net/ceil