PDA

Click to See Complete Forum and Search --> : [RESOLVED] PHP Math Functions


Zeuz
Dec 20th, 2009, 05:47 AM
Amount: Something - Something = 407325.96875

How do i can make this function => ~
I don't know what is it, but i want ~ the amount of items for being answer without 10239293(.29383)

Thanks.

Justa Lol
Dec 20th, 2009, 07:16 AM
you mean round 407325.96875 to a whole number? sorry i don't really get what you mean..

Zeuz
Dec 20th, 2009, 08:28 AM
Yes i want it to be number without . between numbers it should say ~407326 without .96875

SambaNeko
Dec 20th, 2009, 10:30 AM
I'm not sure I get what you mean either, but you might be looking for the floor() (http://php.net/manual/en/function.floor.php) function - it rounds down to a whole number.

kows
Dec 20th, 2009, 10:35 AM
or the round() function to round either down or up. or typecast it to being an int so that it autmatically removes decimal places.

$var = (int) 30223424.24234234;

Justa Lol
Dec 20th, 2009, 03:11 PM
i'm sure he wants to round from the separator into a whole number... if he got 40.546 the number will turn into 41 or if its 40.3 it will turn into 40... if thats what he wants then this might help: http://php.net/manual/en/function.round.php
<?php
$var1 = "1534.4";
echo round($var1);
?>

kows
Dec 20th, 2009, 03:35 PM
uh, yeah, I mentioned that in my post already..

Justa Lol
Dec 20th, 2009, 03:58 PM
oh sorry didn't really read you post...

Zeuz
Dec 20th, 2009, 04:40 PM
Thanks. Any suggestions for?: <?php $NormalTree = 13034431 - $_GET[Experience];
echo $NormalTree / 25 ?>

SambaNeko
Dec 20th, 2009, 05:16 PM
<?php $NormalTree = 13034431 - $_GET[Experience];
echo round($NormalTree / 25); ?>